Python 拉登+;uwsgi:无法加载应用程序
我正在使用在互联网上发布一些API(soap)。 我想使用nginx+uwsgi但我遇到了麻烦: 我将此输出浏览到uwsgi二进制文件提供的页面:Python 拉登+;uwsgi:无法加载应用程序,python,uwsgi,soapserver,ladon,Python,Uwsgi,Soapserver,Ladon,我正在使用在互联网上发布一些API(soap)。 我想使用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)
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
我的CLI是:
uwsgi -s 127.0.0.1:7777 --logto ~/uwsgi.log --wsgi-file /path/scripts/handler.py
handler.py包含:
from ladon.server.wsgi import LadonWSGIApplication
from os.path import abspath,dirname
application = LadonWSGIApplication('serverL','/path/script/src')
以及/path/script中的我的树:
.
├── handler.py
├── src
│ ├── serverL.py
提前感谢我强烈建议您花一些时间来理解PYTHONPATH/sys.path,它是python世界中最重要的方面之一,但很多用户都低估了它(您可以注意到它是部署过程中出现错误的最主要原因之一)
你的问题是python虚拟机无法知道serverL模块在哪里,所以你应该在pythonpath中添加“/path/script/src”(你有多种方法可以做到这一点,最快的是使用--pythonpath-uWSGI选项)我强烈建议你花些时间来理解pythonpath/sys.path,是python世界中最重要的方面之一,但很多用户都低估了它(您可以注意到它是部署过程中出现错误的最主要原因之一) 您的问题是python虚拟机无法知道serverL模块在哪里,因此您应该将“/path/script/src”添加到pythonpath(您有多种方法可以做到这一点,最快的方法是使用--pythonpath uWSGI选项)