user1981924
user1981924

Reputation: 846

uwsgi and flask - cannot import name "appl"

I created several servers, without any issue, with the stack nginx - uwsgi - flask using virtualenv.

with the current one uwsgi is throwing the error cannot import name "appl"

here is the myapp directory structure: /srv/www/myapp + run.py + venv/ # virtualenv + myapp/ + init.py + other modules/ + logs/

here is the /etc/uwsgi/apps-avaliable/myapp.ini

[uwsgi]
# Variables
base = /srv/www/myapp
app = run
# Generic Config
# plugins = http, python
# plugins = python
home = %(base)/venv
pythonpath = %(base)
socket = /tmp/%n.sock
module = %(app)
callable = appl
logto = %(base)/logs/uwsgi_%n.log

and this is run.py

#!/usr/bin/env python

from myapp import appl

if __name__ == '__main__':
    DEBUG = True if appl.config['DEBUG'] else False
    appl.run(debug=DEBUG)

appl is defined in myapp/ _ init _ .py as an instance of Flask()

(underscores spaced just to prevent SO to turn them into bold)

I accurately checked the python code and indeed if I activate manually the virtualenvironment and execute run.py manually everything works like a charm, but uwsgi keeps throwing the import error.

Any suggestion what should I search more ?

Upvotes: 0

Views: 379

Answers (1)

user1981924
user1981924

Reputation: 846

fixed it, it was just a read permissions issue. The whole python app was readable by my user but not by the group, therefore uwsgi could not find it.

This was a bit tricky because I deployed successfully many time with the same script and never had permissions issues

Upvotes: 0

Related Questions