Django Apache mod_wsgi - 无法打开数据库文件

时间:2017-02-27 21:53:10

标签: python django apache sqlite mod-wsgi

将mod_wsgi升级到最新版本后,我的应用程序无法再访问其缓存db(sqlite)。

Apache错误日志显示以下内容:

mod_wsgi (pid=1050): Target WSGI script '/location/to_my_project/project_name/wsgi.py' cannot be loaded as Python module. mod_wsgi (pid=1050): Exception occurred processing WSGI script '/location/to_my_project/project_name/wsgi.py'. aceback (most recent call last): File "/location/to_my_project/project_name/wsgi.py", line 16, in <module> application = get_wsgi_application() File "/location/to/my/env/lib/python3.5/site-packages/django/core/wsgi.py", line 14, in get_wsgi_application return WSGIHandler() File "/location/to/my/env/lib/python3.5/site-packages/django/core/handlers/wsgi.py", line 153, in __init__ self.load_middleware() File "/location/to/my/env/lib/python3.5/site-packages/django/core/handlers/base.py", line 80, in load_middleware middleware = import_string(middleware_path) File "/location/to/my/env/lib/python3.5/site-packages/django/utils/module_loading.py", line 20, in import_string module = import_module(module_path) File "/location/to/my/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 665, in exec_module File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed File "/location/to_my_project/project_name/middleware/some_middleware.py", line 16, in <module> include_get_headers=True, File "/location/to/my/env/lib/python3.5/site-packages/requests_cache/core.py", line 182, in install_cache backend = backends.create_backend(backend, cache_name, backend_options) File "/location/to/my/env/lib/python3.5/site-packages/requests_cache/backends/__init__.py", line 50, in create_backend return registry[backend_name](cache_name, **options) File "/location/to/my/env/lib/python3.5/site-packages/requests_cache/backends/sqlite.py", line 28, in __init__ self.responses = DbPickleDict(location + extension, 'responses', fast_save=fast_save) File "/location/to/my/env/lib/python3.5/site-packages/requests_cache/backends/storage/dbdict.py", line 58, in __init__ with self.connection() as con: File "/usr/lib/python3.5/contextlib.py", line 59, in __enter__ return next(self.gen) File "/location/to/my/env/lib/python3.5/site-packages/requests_cache/backends/storage/dbdict.py", line 70, in connection con = sqlite.connect(self.filename) lite3.OperationalError: unable to open database file

运行该进程的用户在发生错误后创建了该文件。使用该用户登录时,我也可以打开/编辑该文件。其他具有相同问题的用户报告说,将文件路径从绝对路径更改为相对路径已经解决了他们的问题,但我一直都是相对的。缓存也在正确的目录中创建。

mod_wsgi版本:4.5.14(之前的版本4.3.0) Django:1.10 Apache:2.4.18 服务器:Ubuntu 16.04

升级wsgi模块后,我没有更改python路径。什么可能是错的任何建议?

0 个答案:

没有答案