4 ms·
How is deploying Django? Is it easy to integrate with Nginx or Apache? I know PHP is super easy but wasn't sure how it was for Python frameworks?
by nickthemagicman 7y ago
How is deploying Django? Is it easy to integrate with Nginx or Apache?
I know PHP is super easy but wasn't sure how it was for Python frameworks?
- franga2000 7y agoFor Apache, the easiest is just using mod_wsgi and pointing it at your source folder. It takes 3 trivial lines of Apache configs if you're using system-wide Python and 2 additional slightly longer ones to use a virtualenv instead (recommended) - all nice and copy-pastable from the official docs. Nginx has a similar module, but I haven't used it personally.
- DangitBobby 7y agoYou run collectstatic to get all of your static assets in one folder, use gunicorn (python package, there are other options as well such as uwsgi) to serve your wsgi server, and have nginx in front of gunicorn to intercept anything with /static/* to pull from your static assets folder. This is all 3 or 4 lines of config in nginx. Your first try might take a couple of hours to get right. If you want HTTPS (you should) Caddy might be a better route than nginx. It's certainly easier.