Question

I am using to publish some API (soap) over the internet. I would like to use nginx + uwsgi but I am in trouble: I get this output browsing to the page offered by the uwsgi binary:

Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/ladon/server/wsgi_application.py", line 332, in __call__
self.import_services(self.service_list)
 File "/usr/local/lib/python2.7/dist-packages/ladon/server/wsgi_application.py", line 288, in import_services
__import__(service)
 ImportError: No module named serverL

My CLI is:

uwsgi -s 127.0.0.1:7777 --logto ~/uwsgi.log --wsgi-file /path/scripts/handler.py

handler.py contains:

from ladon.server.wsgi import LadonWSGIApplication
from os.path import abspath,dirname

application = LadonWSGIApplication('serverL','/path/script/src')

and my tree in /path/script:

.
├── handler.py
├── src
│   ├── serverL.py

Thanks in advance

Was it helpful?

Solution

I strongly suggest you to invest some time in understanding PYTHONPATH/sys.path, is one of the most important aspect of the python world but lot of users underestimate it (and you can note how it is one of the most prominent cause for errors during deployment).

Your problem is that the python VM has no way to know where serverL module is, so you should add '/path/script/src' to the pythonpath (you have various way to do it, the fastest is using the --pythonpath uWSGI option)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top