- Databases. Set DATABASES to your production database.
- Allowed hosts. Set ALLOWED_HOSTS to the list of domain names to be served by this Django installation. It should be the same list as that listed in nginx’s server_name or in apache’s ServerName and ServerAlias.
- Static files. Set STATIC_ROOT to the directory where the static files should be stored, and STATIC_URL to the URL where they will be found (commonly /static/). In nginx, set this:
location [same as STATIC_URL] { root [same as STATIC_ROOT]; }
In apache, set this:
Alias [same as STATIC_URL] [same as STATIC_ROOT with a trailing slash]; <Directory [same as STATIC_ROOT]> Options -Indexes Require all granted </Directory>
Don’t forget to run collectstatic.
- Media files. Same thing as static files, but also make sure that the user Django is running as has permission to write to MEDIA_ROOT. If you are using mod_wsgi, Django is probably running as user www-data; if you are using gunicorn, it depends on how you have set up gunicorn.
- Email. Regardless whether your project uses email or not, it is very important to set this up so that it can send you information about internal server errors. So you need to use EMAIL_HOST, EMAIL_PORT, EMAIL_HOST_USER, EMAIL_HOST_PASSWORD, EMAIL_USE_TLS, DEFAULT_FROM_EMAIL, and SERVER_EMAIL. Also set up ADMINS and MANAGERS.
- Miscellaneous. Other settings you probably need to set different from development are SECRET_KEY, LOGGING, CACHES. Finally, set DEBUG to
False
.