Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

A deploy tool for Django

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-deploy-kit, version 0.10.2
Filename, size File type Python version Upload date Hashes
Filename, size django-deploy-kit-0.10.2.tar.gz (8.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page