Public Repository

Last pushed: a year ago
Short Description
Base On Alpine Build With Nginx、Supervisor、Gunicorn
Full Description

Alpine Django Images

build with spuervisor + nginx + gunicorn

How To Use This Image

  • Add 'gunicorn' to your settings.py INSTALLED_APPS

    INSTALLED_APPS = [
        'django.contrib.admin',
        'django.contrib.auth',
        'django.contrib.contenttypes',
        'django.contrib.sessions',
        'django.contrib.messages',
        'django.contrib.staticfiles',
    
        'gunicorn'
    ]
    
  • Add Supervisor *.ini Files To your Mapping Folder for /etc/supervispr.d/

    [program:mydjango]
    command=gunicorn mydjango.wsgi -b 127.0.0.1:9090 --reload
    directory=/usr/local/nginx/html/mydjango
    user=root
    numprocs=1
    autostart=true
    autorestart=true
    startretries=10
    stopsignal=INT
    stopwaitsecs=10
    redirect_stderr=true
    stdout_logfile=/var/log/supervisor_uwsgi.log
    

    In this sample you should change the directory and command
    by your apps

  • Add Nginx Conf XXX.conf in the volume folder of "/etc/nginx/conf.d"

     location / {
        proxy_pass http://127.0.0.1:9090;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     }
    
Docker Pull Command
Owner
wodliwu