Heroku Django DEBUG Setting not applied

前端 未结 2 1552
你的背包
你的背包 2020-12-06 10:52

I currently have a running production Django application on Heroku. Unfortunately, I haven\'t been able to turn off the DEBUG setting on Heroku. Turning it off

2条回答
  •  囚心锁ツ
    2020-12-06 11:17

    Does your django settings.py file even look in the environment?

    It does not, by default, care about anything you've set in the environment (via "config:set"). If you're "casting" the environment to a boolean, make sure you're casting it correctly. bool('False') is still True.

    It's simplest just to detect if the environment variable exists so you don't have to worry about type casting or specific formats of the configuration.

    DEBUG = os.environ.get('DEBUG', False)

    To disable debug, remove the variable from the environment instead of trying to type cast... it just seems much more reliable and fool proof. config:unset DEBUG

提交回复
热议问题