django DEBUG=False still runs in debug mode

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

    In case anyone is using .env file or loads environmental variables, I used the below is effectively load the DEBUG env variable in the right type:

    import os
    
    APP_DEGUB_MODE = os.getenv('APP_DEBUG', False)
    DEBUG = eval(APP_DEGUB_MODE) if isinstance(APP_DEGUB_MODE, str) else APP_DEGUB_MODE
    
    

提交回复
热议问题