Flask on Raspberry Pi and starting the flask app on startup

After creating a working flask app on my laptop, which uses the library Matplotlib, i moved the app to my raspberry.

The app itself worked , but the matplotlib plot did not show, due to a parameter that was used : pad = none in plt.title. This did not give an issue on my laptop but it did on the pi. Removing this solved the issue.

Another issue I needed to tackle was starting the app at reboot. My first option of using the script start in : crontab -e did not work. The app was not started. using this command: python3 /var/www/warmte/xxx.py &

Moving the line to rc.local did the job:

  • sudo nano /etc/rc.local
  • add the line: python3 /var/www/warmte/xxx.py &  before the exit 0

Leave a Reply

Your email address will not be published. Required fields are marked *