django DEBUG=False still runs in debug mode

前端 未结 9 763
再見小時候
再見小時候 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:29

    When you use the module decouple (pip install python-decouple) make sure you cast DEBUG to a bool. Thus settings.py should have the following line:

    from decouple import config
    
    DEBUG = config('DEBUG', default=False, cast=bool)
    

    where in the .env file

    DEBUG = False # or True
    

提交回复
热议问题