Skip to main content

Django Deploy

For deploy Django project on Linux server.

Features:

  1. Automatic

  2. Zero downtime

  3. Multiple version

  4. Easy rollback

Requirements on server

  • Nginx
  • Anaconda
  • Nodejs
  • PM2

Quick start

  1. Add "deploy" to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'deploy',
    ]
    
  2. Configure ssh:

    add host config in ~/.ssh/config

    Host host1
        Hostname xxx.xxx.xxx.xxx
        Port 2222
        User xxxx
        ServerAliveInterval 60
        # IdentityFile ~/.ssh/id_rsa_xxxxx
    

    create ssh-key file

    ssh-keygen -t rsa -C "xxxx@xxxx.com"
    

    you could leave a blank for password, when you execute ssh command it will not ask your password again

  3. Add definition in settings of Django app

    GIT_URL = 'git@github.com:path/name.git'
    GIT_DEPLOY_BRANCH = 'stable'
    APP_NAME = 'appname'
    
    DEPLOY = {
        "host1": {  # same as ssh-config
            "task_prefix": "app-process",  # prefix of process name
            "home_path": '/path/to/appname/www',  # path of each versions
            "static_path": '/path/to/appname/statics',  # path of statics for each versions
            "conda_path": '/path/to/anaconda3/bin',  # path of anaconda bin 
            "nginx_conf": "/etc/nginx/sites-enabled/appname",  # enabled site config of Nginx
            "fixed_deploy_path": '/path/to/appname/fixed', # use to do migrate
        }
    }
    
  4. create PM2 and Nginx configure template

    create directory name of deploy in your base path of Django app

    deploy/
    └── templates
        └── deploy
            ├── ecosystem.config.template
            └── nginx.conf.template
    

    content of ecosystem.config.template

    ...
    

    content of nginx.conf.template

Release files for django-deploy-kit 0.10.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-deploy-kit 0.10.2
File Size Uploaded
django-deploy-kit-0.10.2.tar.gz 8.7 kB Details

Release files / django-deploy-kit-0.10.2.tar.gz

Download URL django-deploy-kit-0.10.2.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
44c3134a6de72b6cb16982309cfeed32e868cb3c18c383d95ba8da94b54e5465
BLAKE2b-256 checksum
How to use checksums
947d42d718a88b971652c01d6369a37e3709fcd3b6afa8d1149f6007b9274e98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.6.8

Release history Release notifications | RSS feed

This release

0.10.2 This release

1 release file

0.10.1

1 release file

0.10

1 release file

0.9

1 release file

0.8

1 release file

0.7

1 release file

0.6

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page