Deploy Django App on Seenode | Django Hosting & Deployment Guide | Seenode Docs

Deploy Django App on Seenode | Django Hosting & Deployment Guide

Deploy your Django app on Seenode with a simple setup. Follow our quickstart guide to configure, connect Git, and go live in minutes.

This guide explains how to deploy your existing Django application to seenode. For a production-ready setup, we recommend using a PostgreSQL database and WhiteNoise to serve static files.

Prerequisites

Before you begin, ensure you have:

  • A seenode account at cloud.seenode.com
  • Git configured on your machine
  • Existing Django project ready to deploy

Configure for seenode Deployment

Production Dependencies

For a production setup, add these packages to your requirements.txt:

requirements.txt
gunicorn
dj-database-url
psycopg2-binary # Or the appropriate adapter for your database
whitenoise

Settings Configuration

Update your settings.py for production deployment:

your_project/settings.py
import os
import dj_database_url
# Security settings
SECRET_KEY = os.environ.get('SECRET_KEY')
DEBUG = os.environ.get('DEBUG', 'False').lower() == 'true'
ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '').split(',')
# Database configuration
DATABASES = {
'default': dj_database_url.config(conn_max_age=600, ssl_require=True)
}
# Static files with WhiteNoise
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware', # Add WhiteNoise
# ... other middleware
]
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
Tip (Environment Variables)

The following settings are configured via environment variables:

  • SECRET_KEY: Your Django secret key for cryptographic signing
  • DEBUG: Set to 'true' for development, 'false' for production
  • ALLOWED_HOSTS: Comma-separated list of allowed hostnames, for example:
    • yourdomain.com,www.yourdomain.com
    • example.com,api.example.com,www.example.com

If you’re using seenode’s default service URL, you can find your service domain in the dashboard. Without setting ALLOWED_HOSTS, Django will reject requests and return a “DisallowedHost” error.

Build Script

Create a build.sh script to streamline deployments:

build.sh
#!/usr/bin/env bash
# exit on error
set -o errexit
pip install -r requirements.txt
python manage.py collectstatic --no-input
python manage.py migrate

Make the script executable: chmod +x build.sh

Deploy on seenode

  1. Push to Git

    Commit your project and push it to GitHub or GitLab.

  2. Create a Database (Optional)

    If your application needs a database, create a PostgreSQL Database from the seenode Dashboard. seenode also supports MySQL.

  3. Create a Web Service

    Create a new Web Service and connect your Django project’s Git repository. Configure your build and start commands:

    • Build Command: ./build.sh
    • Start Command: gunicorn your_project.wsgi --bind 0.0.0.0:80
    Configure Build & Start: Port field

    There is no default port. Set the Port field (above Environment Variables) to the value you expect Gunicorn to use (for example, 80 or 8080). Do not rely on a PORT environment variable, instead bind Gunicorn to the exact port you configure here.

  4. Configure Environment Variables

    Navigate to the Environment tab and link your PostgreSQL database.

    Important: You must configure the following required environment variables (as referenced in the Settings Configuration section above):

    • SECRET_KEY: Your Django secret key for cryptographic signing

    • ALLOWED_HOSTS: Comma-separated list of allowed hostnames (e.g., yourdomain.com,www.yourdomain.com). This is required for Django to accept requests from your domain.

    Without setting ALLOWED_HOSTS, your Django application will reject requests and return a “DisallowedHost” error.

  5. Choose Pricing Tier

    Select your preferred instance size and create your service.

  6. Deploy

    Click Create Web Service and watch logs until your web service is live.

  7. Success

    Once complete, your Django application will be accessible via your service’s URL.

Tip (Troubleshooting)

If your deployment fails, the first place to check is the Logs tab in your seenode service dashboard. Build and runtime logs often contain valuable information for diagnosing issues.

Port configuration mismatch

  • There is no default port. Ensure your application listens on the port you set in the Configure Build & Start screen (Port input).
  • Adjust in framework config if needed (for example, update your gunicorn bind port). Do not depend on a PORT environment variable.
  • Seeing a 502 Bad Gateway? This often means your app is not listening on the configured port.

Starting from Scratch?

If you don’t have a Django project yet:

Option 1: Use our Template (Recommended)

Option 2: Create from Django Docs + seenode Setup

Follow the official Django documentation to create a new project, then return here for seenode-specific deployment steps.

seenode-Specific Setup Steps:

  1. Create Django project: django-admin startproject your_project
  2. Install production dependencies
  3. Configure settings for seenode
  4. Create build script

Next Steps

Now that your Django application is deployed, here are some things you might want to do next: