How to Install Django on a Hosting Server: A Step-by-Step Guide
Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. Whether you’re launching a small website or a full-fledged web application, deploying Django on a hosting server is a critical step. In this guide, we’ll walk through the process of installing Django on a typical Linux-based hosting server.
Before beginning, make sure your hosting server has the following:
Access via SSH
Python 3.6+ installed
pip (Python package manager)
Virtualenv (optional but recommended)
A domain or subdomain (optional)
Basic knowledge of Linux commands
Replace username
and your_server_ip
with your actual server credentials.
Navigate to the directory where you want your Django project to live:
Using virtualenv
is a good practice to isolate your project’s dependencies.
Once activated, your terminal prompt will reflect the virtual environment.
With the virtual environment active, run:
You can check the installation with:
Now you can create a new Django project:
The dot at the end ensures the files are placed in the current directory.
Run initial database migrations:
Create an admin user:
Follow the prompts to set up a username and password.
For initial testing, use Django’s built-in server:
You can now visit your server’s IP address on port 8000 in the browser:
For production use, you’ll need:
Gunicorn or uWSGI as a WSGI server
Nginx or Apache as a reverse proxy
PostgreSQL or MySQL if not using SQLite
SSL certificate (optional but highly recommended)
Install Gunicorn:
Run Gunicorn:
For a production setup, configure a systemd service and a reverse proxy with Nginx to manage traffic and ensure your app runs continuously.