Search code examples
linuxuwsgisystemdbootsystemctl

Starting uwsgi with systemd fails -


I run my code on a raspberry pi 4 wit Raspbian GNU/Linux 11 (bullseye) .
I want to start my uwsgi server via systemd. My .ini file:

http = :5000
processes = 4
threads = 2
wsgi-file = /home/pi/Python/uwsgi_examples/hello_flask.py
callable = app

The app is a simple flask application. My my_service.service file:

[Unit]
Description=uwsgi Service
After=network.target
After=network-online.target

[Service]
ExecStart=/home/pi/.local/bin/uwsgi --ini /home/pi/Python/uwsgi_examples/flask.ini
Restart=always
KillSignal=SIGQUIT

[Install]
WantedBy=multi.user.target

When I run:

sudo systenctl start my_service.service

all works fine but after a reboot the sever is not running. (I enabled my service) When I run:

sudo systemctl status my_service

I get the following feedback:

my_service.service - uwsgi Service
     Loaded: loaded (/etc/systemd/system/my_service.service; enabled; vendor pr>
     Active: inactive (dead)

Any suggestions?


Solution

  • I finally found my mistake. I had a typo in the .sevice file. After correcting

    [Install]
    WantedBy=multi.user.target
    

    to

    [Install]
    WantedBy=multi-user.target
    

    the server starts at reboot