۵۰٪ تخفیف روی همه پلان‌ها، محدود. شروع از $2.48/mo
Django

Django

Django is the Python web framework with batteries included. ORM, admin UI, auth, forms, and security primitives for database-driven sites. Used at Instagram, Mozilla, Pinterest, and the Washington Post. The framework that perfectionists with deadlines pick.

Version

Latest

Operating System

Ubuntu Server 24.04 LTS

Min. RAM

1 GB

IP Types

IPV4,IPV6

1. SSH to Your Server

ssh root@<server-ip>

2. Find Login Credentials

  • Default user: django
  • Password stored in: /root/.cloudzy-creds

(Optional) Change the default password: passwd django

3. Switch to the App User

su - django

4. PostgreSQL (Optional)

If PostgreSQL was installed, set up DB and user (example):

sudo -u postgres psql
CREATE DATABASE <db>;
CREATE USER <user> WITH PASSWORD <password>;
GRANT ALL PRIVILEGES ON DATABASE <db> TO <user>;
q

Then update settings.py DATABASES with host localhost, database name, user, and password. Run python manage.py migrate.

5. Deploy Your App

A sample Flask app is already running and accessible at: http://<server-ip

To deploy your own app:

  1. Navigate to your application directory (or clone a new project): cd ~/django_app
  2. (Optional) Replace default app: git clone <your_repo_url> .
  3. Activate the virtual environment: source venv/bin/activate
  4. Install required packages: pip install -r requirements.txt
  5. Adjust settings.py: set ALLOWED_HOSTS to your domain/IP and ensure STATIC_ROOT exists.
  6. Migrate database: python manage.py migrate
  7. Collect static into STATIC_ROOT: python manage.py collectstatic --noinput
  8. Restart Gunicorn to apply changes: sudo systemctl restart gunicorn
  9. Restart Nginx: sudo systemctl restart nginx

6. Access Your App

Your Django app is available at: http://<server-ip

Nginx is reverse-proxying requests to Gunicorn via Unix socket.

7. Change Port or Domain?

To adjust domain, port, or add SSL:

  1. Edit Nginx site config: sudo nano /etc/nginx/sites-available/gunicorn_django
  2. Test configuration: sudo nginx -t
  3. Reload Nginx: sudo systemctl restart nginx

8. Enable HTTPS (Optional)

Use Certbot to enable HTTPS.

Install certbot:

sudo apt install certbot python3-certbot-nginx -y

Get certificates & update Nginx automatically:

sudo certbot --nginx -d example.com

Test:

nginx -t && sudo systemctl reload nginx

More in Development Tools

Related apps.

Deploy Django now. از ۲٫۴۸ دلار در ماه.