Hey! I followed the full and amazing series of articles by Mitchell Anicas, Brian Boucheron, Jeremy Morris, Lisa Tagliaferri:
That helped me learn how to deploy a Django app to a Linux droplet. I got through without a hitch, which is very rare and testifies to excellent articles.
My question is, what now? In article #5, Morris mentions that:
“Note that this will provide you with a development environment in which to work on your blog web app, but you will need to take more steps before you put your blog live on the internet, and will need to set up domain names, and add additional layers of security.”
Do you have any articles about best practices for deploying a web site? For example, my serve command of course cancels whenever I close my SSH connection, and I want it to run continuously - that’s the whole point of a VPS. I also probably should change my Django app’s DEBUG variable to false, and there are probably other things I should know. These Digital ocean writers have already provided me with a lot of great information, but I was hoping that there was more out there for me to continue learning.
Thanks a ton for your time.
best,
Elijah
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Heya,
etting up Nginx as a reverse proxy for a Django application and configuring PostgreSQL as the database backend involves several steps. This tutorial will walk you through installing and configuring these components on a Linux server (Ubuntu as an example).
Prerequisites
Step 1: Install Required Packages
First, update your package list and install Python, pip, virtualenv, PostgreSQL, and Nginx.
Step 2: Set Up PostgreSQL
Create a PostgreSQL database and user for your Django application.
Step 3: Create a Python Virtual Environment
Create a directory for your project, set up a virtual environment, and install Django.
Step 4: Start a Django Project
DATABASES
setting inmyproject/settings.py
:Step 5: Set Up Nginx as a Reverse Proxy
sites-enabled
:Step 6: Collect Static Files
myproject/settings.py
to include:This setup should get your Django application running with PostgreSQL as the database, served by Nginx as a reverse proxy on a Linux server. Remember to replace placeholders like
username
,server_domain_or_IP
, and paths as necessary to match your actual setup.Hi there,
Really happy to hear that those tutorials were helpful!
Yes, you can follow the steps here on how to deploy Django with Gunicorn and Nginx:
https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-18-04
That way when you close your SSH session, the service would still be up and running on the server.
Hope that this helps! Best, Bobby