我在 VirtualEnv 和 Python 3.5 中的基于 Debian 的系统上安装了 Weblate==3.10
如果我使用命令运行 Weblate =>
weblate runserver
开发服务器启动,一切正常。
但是,如果我尝试使用 gunicorn 运行该项目,则会出现导入错误。
pwd
/var/www/ws5weblate/priv/weblate-env/lib/python3.5/site-packages/weblate
gunicorn wsgi:weblate
[2020-01-02 09:26:09 +0000] [22587] [INFO] Starting gunicorn 20.0.4
[2020-01-02 09:26:09 +0000] [22587] [INFO] Listening at: http://127.0.0.1:8000 (22587)
[2020-01-02 09:26:09 +0000] [22587] [INFO] Using worker: sync
[2020-01-02 09:26:09 +0000] [22590] [INFO] Booting worker with pid: 22590
[2020-01-02 09:26:09 +0000] [22590] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/var/www/ws5weblate/priv/weblate-env/lib/python3.5/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/var/www/ws5weblate/priv/weblate-env/lib/python3.5/site-packages/gunicorn/workers/base.py", line 119, in init_process
self.load_wsgi()
File "/var/www/ws5weblate/priv/weblate-env/lib/python3.5/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
self.wsgi = self.app.wsgi()
File "/var/www/ws5weblate/priv/weblate-env/lib/python3.5/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/var/www/ws5weblate/priv/weblate-env/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
return self.load_wsgiapp()
File "/var/www/ws5weblate/priv/weblate-env/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
return util.import_app(self.app_uri)
File "/var/www/ws5weblate/priv/weblate-env/lib/python3.5/site-packages/gunicorn/util.py", line 358, in import_app
mod = importlib.import_module(module)
File "/var/www/ws5weblate/priv/weblate-env/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 673, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/var/www/ws5weblate/priv/weblate-env/lib/python3.5/site-packages/weblate/wsgi.py", line 45, in <module>
application = get_wsgi_application()
File "/var/www/ws5weblate/priv/weblate-env/lib/python3.5/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
django.setup(set_prefix=False)
File "/var/www/ws5weblate/priv/weblate-env/lib/python3.5/site-packages/django/__init__.py", line 19, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
File "/var/www/ws5weblate/priv/weblate-env/lib/python3.5/site-packages/django/conf/__init__.py", line 79, in __getattr__
self._setup(name)
File "/var/www/ws5weblate/priv/weblate-env/lib/python3.5/site-packages/django/conf/__init__.py", line 66, in _setup
self._wrapped = Settings(settings_module)
File "/var/www/ws5weblate/priv/weblate-env/lib/python3.5/site-packages/django/conf/__init__.py", line 157, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/var/www/ws5weblate/priv/weblate-env/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 944, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 673, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/var/www/ws5weblate/priv/weblate-env/lib/python3.5/site-packages/weblate/__init__.py", line 23, in <module>
from weblate.celery import app as celery_app
File "/var/www/ws5weblate/priv/weblate-env/lib/python3.5/site-packages/weblate/celery.py", line 26, in <module>
from celery import Celery
File "/var/www/ws5weblate/priv/weblate-env/lib/python3.5/site-packages/weblate/celery.py", line 26, in <module>
from celery import Celery
ImportError: cannot import name 'Celery'
[2020-01-02 09:26:09 +0000] [22590] [INFO] Worker exiting (pid: 22590)
[2020-01-02 09:26:09 +0000] [22587] [INFO] Shutting down: Master
[2020-01-02 09:26:09 +0000] [22587] [INFO] Reason: Worker failed to boot.
不确定这是否是一个错误。我想我错过了一些东西。任何想法?