MarkB MarkB - 8 months ago 57
Python Question

start flask server @ startup with supervisor: FATAL Exited too quickly

I am trying to start my flaskserver at startup with the help of supervisor. But i get this error message:

python_auutostart FATAL Exited too quickly (process log may have details)

This is the entry in my logfile:

Traceback (most recent call last):
File "", line 2, in <module>
from app import app
File "/home/flaskserver/app/", line 1, in <module>
from flask import Flask
ImportError: No module named flask

This is my .conf:

command = python
directory = /home/flaskserver/
autostart = true
autorestart = true

I can start my flaskserver without problems if I run ./ but I don´t get it to run with supervisor. I don´t see why i get the ImportError i posted. Maybe some1 can point me to my probleme here.


The python you use is the default system python (you can check that wich which python which should display something like /usr/bin/python or wherever your system python is). This does not have access (by default) to libraries that are installed in a virtual environment. Instead you should use the python that is specific to the virtualenv. You can do that by explicitly calling the python which should be located in /path/to/virtualenv/env/bin/python. You can check that by activating the virtualenv and which python which should output the path to the python of the virtualenv.