How do you deploy a Django application on the App platform? Specifically, how do you add/configure Nginx to serve static files?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Your setup does not include Nginx at all. Can you run a prod application with only Gunicorn?
This may help as well; I put together an app spec YAML that models a Django app with a service, static site for staticfiles, migration job, and DB:
This can be submitted using
doctl
with:Hello @idiallo
Yes, it’s possible to host a Django app in App Platform. We have a sample Django app in our GitHub repo which you can consider as an example and make necessary changes in your app:
https://github.com/digitalocean/sample-django
Please note that at least one of the requirements.txt, Pipfile, and setup.py must be located in the root directory of the repo.
Here’s the documentation for more information: https://www.digitalocean.com/docs/app-platform/languages-frameworks/python/
Static files are served using global CDN and there is no specific configuration done in the webserver for static files.
Cheers,
Dikshith