following two Trac tickets requesting django docs to do better on mentioning how to deploy an app behind a proxy / an overall starter on having a production environment instead of having to piece it together from sources…
I wrote this article with all the details needed for a bare-minimum production (IMO):
before opening a PR with a shorter version of the article,
I want to ask:
- if this is adequate to what people imagine to find?
- did it fail to mention anything? What would you guys add?
- what parts aren’t really related to Django and should be left out…
tickets:
I really think a more appropriate configuration for static and media files should be encouraged, and specific directories be identified as targets.
For example, specify /var/www/project/static
and /var/www/project/media
for those files, with the related Django configuration settings and the appropriate permissions. This also implies the use of collectstatic
somewhere within the deployment process.
I’d also consider suggesting that the project itself be deployed into a neutral location such as /opt
rather than any location within /home
.
thanx @KenWhitesell,
the updated version made sure to mention static/media setup and setting the permission and access/error log…
didn’t mention much about setting up logging, though docs are already well details about that.
went with the following directory structure:
/opt
├── project_name/
│ ├── manage.py
│ ├── media/
│ ├── project_name/
│ │ ├── asgi.py
│ │ ├── __init__.py
│ │ ├── settings.py
│ │ ├── urls.py
│ │ └── wsgi.py
│ ├── static/
│ └── venv/
/var/log
├── nginx
│ ├── django_access.log
│ ├── django_error.log
│ ├── media_access.log
│ └── media_error.log