- Username is
user
- User is in group
user
- User's home is
/home/user
- Python application is in
/home/user/pythonapp
- Python script is named
start.py
- Virtual environment is
/home/user/.virtualenvs/pythonapp
created withpython -m venv /home/user/.virtualenvs/pythonapp
You can add multiple Environment
lines if you need more env-variables
- Usually systemd unit goes to
/etc/systemd/system/pythonapp.service
- Reload systemd after changing unit files:
systemctl daemon-reload
- Enable units by
systemctl enable pythonapp
- Start with
systemctl start pythonapp
- Stdout and Stderr will go to the system journal:
journalctl -xeu pythonapp
to view