django DEBUG=False still runs in debug mode

前端 未结 9 730
再見小時候
再見小時候 2021-01-12 21:45

I\'m having issues setting my DEBUG = False on my deployed server (on heroku).

I don\'t believe I\'ve seen this before, but setting debug to false is not

9条回答
  •  [愿得一人]
    2021-01-12 22:19

    The root cause of issue - False translated to 'False' string not bool.

    Used next solution (settings.py):

    DEBUG = os.getenv('DEBUG', False) == 'True'
    

    i.e.: in this case DEBUG will set to (bool) True, only if the environment variable is explicitly set to True or 'True'.

    Good luck configuring! :)

提交回复
热议问题