Saturday, August 12, 2023

some notes on using supervisord to start a flask web app on Raspberry Pi or Ubuntu-based systems


One of the methods suggested to start a python flask web app on boot was to use supervisor. Since I installed it with apt, the suggested method to create a configuration file did not work.

Also, it is apt install supervisor, and not apt install supervisord.

sudo apt install supervisor
looks like /etc has a supervisor directory and a conf.d directory inside it!
sudo service supervisor status
not supervisord

Also, supervisor seems to search for and use supervisord.conf files, so we must ensure wrong or backup files are renamed to something else. 

INFO exited: flask_app (exit status 1; not expected
This was apparently due to not using the user=ouruser in the config file.

Final configuration was just by appending the following to the existing /etc/supervisor/supervisord.conf file.

[program:flask_app]
user = ouruser
command = /usr/bin/python ourapp.py
directory = /home/our/path/to/WebServer
autostart = true
autorestart = true

Then, to add a favicon, we need to add a route:


Authentication, or running on android - 

No comments:

Post a Comment