2

I have a simple Flask app (called io_server) within a virtualenv. This directory structure looks like this:

root@beaglebone:/home/debian/io_server

I want to automatically start the Flask app on reboot of the Beagle Bone.

To do this I created a crontab with the following line:

@reboot cd /home/debian/io_server && . venv/bin/activate && flask run --host=0.0.0.0

It doesn't work.

Is there an obvious problem with the command in the crontab? otherwise is there a way to inspect the output of the attempted execution of this command?

EngineerCamp
  • 661
  • 1
  • 6
  • 16

1 Answers1

1

I thought exporting the FLASK_APP environment variable was a permanent export. Apparently not.

Changing the command to:

@reboot cd /home/debian/io_server && . venv/bin/activate && export FLASK_APP=io_server.py && flask run --host=0.0.0.0

has solved the problem.

EngineerCamp
  • 661
  • 1
  • 6
  • 16