Skip to content

Instantly share code, notes, and snippets.

@dvmn-tasks
Last active April 1, 2023 15:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvmn-tasks/1fbf6a96aba64146f86a5559e2f07eb5 to your computer and use it in GitHub Desktop.
Save dvmn-tasks/1fbf6a96aba64146f86a5559e2f07eb5 to your computer and use it in GitHub Desktop.
# Configuration is dased on official Gunicorn docs: https://docs.gunicorn.org/en/latest/deploy.html?highlight=systemd#systemd
[Unit]
Description=Django micro-service to serve MyIP project
After=network.target

[Service]
User=root
Group=root
WorkingDirectory=/opt/myip-multi-framework/django_project/
Environment="DJ_DEBUG=False"
Environment="DJ_ALLOWED_HOSTS=206.189.61.169"  # ! Замените адрес на свой
ExecStart=/opt/myip-multi-framework/venv/bin/gunicorn -b 206.189.61.169:8081 --workers 3 django_project.wsgi:application  # ! Замените адрес на свой
ExecReload=/bin/kill -s HUP $MAINPID
KillMode=mixed
TimeoutStopSec=5
PrivateTmp=true
Restart=on-failure
RestartSec=2

[Install]
WantedBy=multi-user.target
# Configuration is dased on official Gunicorn docs: https://docs.gunicorn.org/en/latest/deploy.html?highlight=systemd#systemd
[Unit]
Description=Flask micro-service to serve MyIP project
After=network.target

[Service]
User=root
Group=root
WorkingDirectory=/opt/myip-multi-framework/flask_project/
ExecStart=/opt/myip-multi-framework/venv/bin/gunicorn -b 206.189.61.169:8080 --workers 3 app:app  # ! Замените адрес на свой
ExecReload=/bin/kill -s HUP $MAINPID
KillMode=mixed
TimeoutStopSec=5
PrivateTmp=true
Restart=on-failure
RestartSec=2

[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment