I am trying to get uwsgi working in combination with nginx for a flask application. This is UWSGI ini file:
[uwsgi]
socket = 127.0.0.1:8001
processes = 4
module = run:manager
virtualenv = /var/www/test/venv
chdir = /var/www/test
logto = uwsgi.log
In the directory /var/www/test I have this file run.py
from flask.ext.migrate import Migrate, MigrateCommand
from flask.ext.script import Manager
from app import app, db
if __name__ == "__main__":
migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command('db', MigrateCommand)
manager.run()
When I run it I get this error:
Set PythonHome to /var/www/test/
ImportError: No module named site
Can anyone tell me where I am going wrong please?
Best Answer
In my case, being new to uwsgi, I didn't understand where virtualenvs end up by default (under ~/.virtualkenvs directory). For my moztrap app, the appropriate configuration turned out to be:
I messed around with module and virtualenv, and this is the combination that worked for me. Note, the wsgi.py file contains the following.
I also tried loading uwsgi using apt-get then pip, but didn't in the end need to do a symlink - so I preume its using the one apt-get installed.
Thanks mainly to the following (and a few others that lack of rep points wont let me thank):