How to create systemd for django python under ubuntu?

I created /etc/systemd/system/django.service

[Unit]
Description=Unit crm3
After=network.target
[Service]
Restart=on-failure
WorkingDirectory=/var/www/repocrm3/RepositoryCRM3/
ExecStart=/var/www/repocrm3/repocrm3_env/bin/gunicorn RepositoryCRM3.wsgi -b 0.0.0.0:8000
[Install]
WantedBy=multi-user.target

systemctl daemon-reload

systemctl -l status django

enter image description here

if i run directly via python manage.py runserver everything works. what is the problem?

(repocrm3_env) lapitsky@crm3:/var/www/repocrm3/RepositoryCRM3$ **python manage.py runserver**
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
April 09, 2022 - 00:33:46
Django version 3.1.4, using settings 'RepositoryCRM3.settings'
Starting development server at
Quit the server with CONTROL-C.
1 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like