将 djoser 添加到我的 Django 应用程序并在 localhost 上进行所有测试都可以正常工作。然而,在重新启动 apache2(应用程序已经添加到 apache 并且工作正常)之后,它给出了内部服务器错误 500。
环顾四周,并按照这些说明获取实际错误。
产生以下
Traceback (most recent call last):
File "<path_to_app>/wsgi.py", line 21, in <module>
application = get_wsgi_application()
File "<path_to_app>/env/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
django.setup(set_prefix=False)
File "<path_to_app>/env/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "<path_to_app>/env/lib/python3.6/site-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "<path_to_app>/env/lib/python3.6/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'djoser'
mod_wsgi (pid=7989): Target WSGI script '<path_to_app>/wsgi.py' does not contain WSGI application 'application'.
mod_wsgi (pid=8126): Target WSGI script '<path_to_app>/wsgi.py' does not contain WSGI application 'application'.
我不知道为什么它说没有名为“djoser”的模块,python/pip 告诉我它已安装并且正在本地主机上运行。