GetItDone
GetItDone

Reputation: 576

Heroku: UserWarning: Using settings.DEBUG leads to a memory leak, never use this setting in production environments

How do I use my production settings with heroku? This is my first attempt at any project deployment that I created ever, so I may be doing things completely wrong. I have a settings.py file and a settings_production file, but I can't seem to figure out how to get the production settings to work. I tried changing my manage.py from

"DJANGO_SETTINGS_MODULE", "myproject.settings"

to

"DJANGO_SETTINGS_MODULE", "myproject.settings_production"

then using the commands

git add .
git commit -m "production settings"

and I have also just tried changing DEBUG to False in my settings.py file. How do you commit changes to your settings in heroku or point to the correct file? I was able to get through the tutorial successfully, but I have not had luck trying to deploy my project. Also, should there be code that I add to manage.py that checks if it is a production or develop environment and uses the correct settings file accordingly, or do I manually change it? Still learning so I could be doing it completely wrong. Thanks for any help.

Upvotes: 0

Views: 2325

Answers (1)

Thomas Orozco
Thomas Orozco

Reputation: 55207

In Heroku, you can configure environment variables - they are called config vars.

The DJANGO_SETTINGS_MODULE environment variable should be set to myproject.settings_production.


Your manage.py is probably not being run in Heroku (there are other ways to run a Django app), which is why your change didn't work.

Upvotes: 2

Related Questions