Qo'llanma8 min read·22-aprel, 2026

How to Deploy a Django App on if.uz — Complete Guide for Uzbek Developers

Deploy your Django application to if.uz with automatic detection, Postgres, static files, and HTTPS. Step-by-step guide for Uzbekistan developers.

Django is the most popular Python web framework, widely used in Uzbekistan's tech community for everything from university projects to production e-commerce sites. if.uz makes deploying Django as simple as pushing to GitHub.

Project Structure Requirements

Nixpacks detects Django automatically if you have a requirements.txt and a manage.py at your project root. No Dockerfile required.

bash
my-django-project/
├── manage.py
├── requirements.txt
├── Procfile          ← tells if.uz how to start the app
├── myapp/
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
└── ...

Step 1 — requirements.txt

Include Django and gunicorn (the production WSGI server). Nixpacks installs everything in requirements.txt:

bash
Django>=4.2
gunicorn>=21.2
psycopg2-binary>=2.9      # PostgreSQL adapter
dj-database-url>=2.0      # Parse DATABASE_URL string
whitenoise>=6.6           # Serve static files without a separate web server
python-decouple>=3.8      # Read .env variables

Step 2 — Procfile

bash
web: gunicorn myapp.wsgi --workers 2 --bind 0.0.0.0:$PORT --log-file -

⚠️ Warning

Replace "myapp" with the name of your Django project (the folder containing wsgi.py). Use $PORT — if.uz injects the port at runtime.

Step 3 — Production Settings

Update your settings.py for production. The cleanest approach is to read everything from environment variables:

python
import os
import dj_database_url

SECRET_KEY = os.environ.get('SECRET_KEY', 'dev-key-change-me')
DEBUG = os.environ.get('DEBUG', 'False') == 'True'

ALLOWED_HOSTS = ['*']  # or list your specific domains

# Database — reads DATABASE_URL env var
DATABASES = {
    'default': dj_database_url.config(
        default='sqlite:///db.sqlite3',
        conn_max_age=600,
    )
}

# Static files — WhiteNoise serves them directly
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'whitenoise.middleware.WhiteNoiseMiddleware',  # ← add after SecurityMiddleware
    ...
]

Step 4 — Deploy on if.uz

  1. 1Push your code to GitHub
  2. 2Sign in to if.uz and click "Deploy new app"
  3. 3Select your GitHub repo and branch
  4. 4Click Deploy — Nixpacks detects Python, installs requirements, and starts gunicorn

Step 5 — Add Environment Variables

In your dashboard, go to Environment Variables and add:

bash
SECRET_KEY=your-long-random-secret-key-here
DEBUG=False
ALLOWED_HOSTS=yourapp-username.if.uz,yourdomain.uz

Step 6 — Add Postgres from Marketplace

  1. 1Go to Marketplace → Deploy PostgreSQL
  2. 2Copy the internal connection URL from Connection Details
  3. 3Add it as DATABASE_URL in your environment variables
  4. 4Redeploy the app
  5. 5Run migrations: open the dashboard logs, or add a release command

💡 Tip

To run migrations on every deploy, add a release phase to your Procfile: "release: python manage.py migrate". Nixpacks/Procfile will run this before starting gunicorn.

bash
# Procfile with automatic migrations
release: python manage.py migrate --noinput && python manage.py collectstatic --noinput
web: gunicorn myapp.wsgi --workers 2 --bind 0.0.0.0:$PORT --log-file -

Common Issues

IssueFix
DisallowedHost errorAdd your if.uz subdomain to ALLOWED_HOSTS in settings.py or env var
Static files 404Make sure WhiteNoise is in MIDDLEWARE and STATIC_ROOT is set. Run collectstatic in release command.
psycopg2 install failsUse psycopg2-binary in requirements.txt (not psycopg2)
Port binding errorUse $PORT in gunicorn --bind, not a hardcoded number

Django on if.uz is a powerful combination: Python's best web framework on Uzbekistan's best hosting platform. No DevOps degree required.

Deploy qilishga tayyormisiz?

Bepul plan, kredit karta kerak emas, 2 daqiqada jonli.

Bepul boshlash →