![在 ubuntu 服务器上使用 uwsgi 安装 Pootle](https://linux22.com/image/560441/%E5%9C%A8%20ubuntu%20%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B8%8A%E4%BD%BF%E7%94%A8%20uwsgi%20%E5%AE%89%E8%A3%85%20Pootle.png)
我正在尝试在 uwsgi 下的 ubuntu 服务器上安装 Pootle 服务器。虽然在我的本地开发服务器上一切正常,但在线时我遇到了这个无法克服的错误。它似乎与应用程序有关,而不是与服务器有关,但由于它在我的(相同的)开发服务器上运行...天哪...我不知道!
提前谢谢!gabriele
[uWSGI] getting INI configuration from pootle.ini
*** Starting uWSGI 0.9.9-dev-1458-unbit (32bit) on [Fri Sep 2 18:53:36 2011] ***
compiled with version: 4.2.4 (Ubuntu 4.2.4-1ubuntu4) on 29 August 2011 11:37:34
detected binary path: /opt/unbit/bin/uwsgi
your process address space limit is 67108864 bytes (64 MB)
your memory page size is 4096 bytes
uwsgi socket 0 inherited UNIX address /var/lib/apache2/upstream/13981_upstream.sock fd 0
Python version: 2.5.2 (r252:60911, Jan 20 2010, 22:05:59) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)]
Set PythonHome to /accounts/gabriobald/www/translate.9thcircle.it
Python main interpreter initialized at 0x91cc2b8
*** Operational MODE: single process ***
added /accounts/gabriobald/www/ to pythonpath.
WSGI application 0 (mountpoint=) ready on interpreter 0x91cc2b8 pid: 16484 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 16484)
spawned uWSGI worker 1 (pid: 16486, cores: 1)
Traceback (most recent call last):
File "/accounts/gabriobald/www/translate.9thcircle.it/lib/python2.5/site-packages/django/core/handlers/wsgi.py", line 250, in __call__
self.load_middleware()
File "/accounts/gabriobald/www/translate.9thcircle.it/lib/python2.5/site-packages/django/core/handlers/base.py", line 47, in load_middleware
raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % (mw_module, e))
django.core.exceptions.ImproperlyConfigured: Error importing middleware pootle_misc.middleware.baseurl: "No module named pootle_misc.middleware.baseurl"
[pid: 16486|app: 0|req: 1/1] 88.50.43.19 () {38 vars in 863 bytes} [Fri Sep 2 18:53:38 2011] GET / => generated 0 bytes in 167 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)
Traceback (most recent call last):
File "/accounts/gabriobald/www/translate.9thcircle.it/lib/python2.5/site-packages/django/core/handlers/wsgi.py", line 250, in __call__
self.load_middleware()
File "/accounts/gabriobald/www/translate.9thcircle.it/lib/python2.5/site-packages/django/core/handlers/base.py", line 47, in load_middleware
raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % (mw_module, e))
django.core.exceptions.ImproperlyConfigured: Error importing middleware pootle_misc.middleware.baseurl: "No module named pootle_misc.middleware.baseurl"
[pid: 16486|app: 0|req: 2/2] 88.50.43.19 () {36 vars in 794 bytes} [Fri Sep 2 18:53:38 2011] GET /favicon.ico => generated 0 bytes in 2 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)
答案1
Error importing middleware pootle_misc.middleware.baseurl: "No module named pootle_misc.middleware.baseurl"
这意味着它无法加载应用程序所需的 Python 代码。由于 django 是从站点包运行的,因此模块pootle_misc
可能应该在那里(或者在相对路径中也可以)。查找其中pootle_misc
的目录/accounts/gabriobald/www/translate.9thcircle.it/lib/python2.5/site-packages/
- 它可能位于您的开发系统上,而不是您的实时系统中。
答案2
您必须在 wsgi.py 中添加更多站点目录:
...
ALLDIRS = [
'/usr/pkg/lib/python2.7/site-packages',
'/usr/pkg/lib/python2.7/site-packages/pootle/apps',
]
for directory in ALLDIRS:
site.addsitedir(directory)
...