Deploy Django App on Seenode | Django Hosting & Deployment Guide
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
Section titled “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
Section titled “Configure for seenode Deployment”Production Dependencies
Section titled “Production Dependencies”For a production setup, add these packages to your requirements.txt:
gunicorndj-database-urlpsycopg2-binary # Or the appropriate adapter for your databasewhitenoiseSettings Configuration
Section titled “Settings Configuration”Update your settings.py for production deployment:
import osimport dj_database_url
# Security settingsSECRET_KEY = os.environ.get('SECRET_KEY')DEBUG = os.environ.get('DEBUG', 'False').lower() == 'true'ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '').split(',')
# Database configurationDATABASES = { 'default': dj_database_url.config(conn_max_age=600, ssl_require=True)}
# Static files with WhiteNoiseMIDDLEWARE = [ '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'Build Script
Section titled “Build Script”Create a build.sh script to streamline deployments:
#!/usr/bin/env bash# exit on errorset -o errexit
pip install -r requirements.txt
python manage.py collectstatic --no-inputpython manage.py migrateMake the script executable: chmod +x build.sh
Deploy on seenode
Section titled “Deploy on seenode”-
Push to Git
Commit your project and push it to GitHub or GitLab.
-
Create a Database (Optional)
If your application needs a database, create a PostgreSQL Database from the seenode Dashboard. seenode also supports MySQL.
-
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:
Start Command:./build.shgunicorn your_project.wsgi --bind 0.0.0.0:${PORT:-80}
-
Configure Environment Variables
Navigate to the Environment tab and link your PostgreSQL database. seenode will automatically configure the
DATABASE_URL. Configure your production environment variables, includingSECRET_KEYandALLOWED_HOSTS. -
Choose Pricing Tier
Select your preferred instance size and create your service.
-
Deploy
Click Create Web Service and watch logs until your web service is live.
-
Success
Once complete, your Django application will be accessible via your service’s URL.
Starting from Scratch?
Section titled “Starting from Scratch?”If you don’t have a Django project yet:
Option 1: Use our Template (Recommended)
Django Template
Deploy a Django project pre-configured with Gunicorn for production.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:
- Create Django project:
django-admin startproject your_project - Install production dependencies
- Configure settings for seenode
- Create build script
Next Steps
Section titled “Next Steps”Now that your Django application is deployed, here are some things you might want to do next:
Set up a Custom Domain (Coming Soon)
Configure a custom domain to point to your new web service.Connect to a Database
Instantly scaffold and connect PostgreSQL and MySQL databases