Skip to content

Instantly share code, notes, and snippets.

@meetsohail
Last active December 3, 2021 20:13
Show Gist options
  • Save meetsohail/a031c38790b96e1900f6004075acfa50 to your computer and use it in GitHub Desktop.
Save meetsohail/a031c38790b96e1900f6004075acfa50 to your computer and use it in GitHub Desktop.
Gunicorn Configuration with Django
# Paste this service file in
# /etc/systemd/system
[Service]
User=user_name
Group=group_name
EnvironmentFile=/home/vars.ini
WorkingDirectory=/home/path_to_django_root_dir
Environment="PATH=/home/path_to_virtual_env_dir/bin"
Restart=always
RestartSec=3
ExecStart=/home/path_to_virtual_env_dir/bin/gunicorn -c /home/path_to_root_dir_project/project_directory/gunicorn.py --workers 3 --worker-class gevent --worker-connections 1000 --worker-tmp-dir /dev/shm --bind unix:/home/path_to_root_dir_project/project_directory/rankspy.sock project_name.wsgi
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment