[英]ladon + uwsgi: unable to load app
I am using to publish some API (soap) over the internet. 我用来通过互联网发布一些API(肥皂)。 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:
我想使用nginx + uwsgi,但遇到麻烦了:我浏览到uwsgi二进制文件提供的页面时得到以下输出:
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: 我的CLI是:
uwsgi -s 127.0.0.1:7777 --logto ~/uwsgi.log --wsgi-file /path/scripts/handler.py
handler.py contains: handler.py包含:
from ladon.server.wsgi import LadonWSGIApplication
from os.path import abspath,dirname
application = LadonWSGIApplication('serverL','/path/script/src')
and my tree in /path/script: 和我的树在/ path / script中:
.
├── handler.py
├── src
│ ├── serverL.py
Thanks in advance 提前致谢
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). 我强烈建议您花一些时间来理解PYTHONPATH / sys.path,这是python世界中最重要的方面之一,但是很多用户都低估了它(您可以注意到它是导致错误的最主要原因之一)部署)。
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) 您的问题是python虚拟机无法知道serverL模块在哪里,因此您应该在pythonpath中添加“ / path / script / src”(您可以使用多种方法,最快的方法是使用--pythonpath uWSGI选项)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.