使用apache部署Django频道-没有名为“频道”的模块

遇到500 Internal Server Error,并在apache日志中找到无法找到channel模块的地方。

Apache错误日志:

[Fri Jun 19 07:39:53.574508 2020] [wsgi:error] [pid 14184] [remote
79.160.57.239:48226] mod_wsgi (pid=14184): Failed to exec Python script file '/var/www/fplstats/python-django-fplstats/fplstats/wsgi.py'. [Fri Jun 19 07:39:53.574573 2020] [wsgi:error] [pid 14184] [remote
79.160.57.239:48226] mod_wsgi (pid=14184): Exception occurred processing WSGI script '/var/www/fplstats/python-django-fplstats/fplstats/wsgi.py'. [Fri Jun 19 07:39:53.575320 2020] [wsgi:error] [pid 14184] [remote
79.160.57.239:48226] Traceback (most recent call last): [Fri Jun 19 07:39:53.575367 2020] [wsgi:error] [pid 14184] [remote
79.160.57.239:48226]   File "/var/www/fplstats/python-django-fplstats/fplstats/wsgi.py",line 16,in <module> [Fri Jun 19 07:39:53.575374 2020] [wsgi:error] [pid 14184] [remote 79.160.57.239:48226]     application = get_wsgi_application() [Fri Jun 19 07:39:53.575381 2020] [wsgi:error] [pid 14184] [remote
79.160.57.239:48226]   File "/var/www/fplstats/fplstatsenv/lib/python3.6/site-packages/django/core/wsgi.py",line 12,in get_wsgi_application [Fri Jun 19 07:39:53.575386 2020] [wsgi:error] [pid 14184] [remote 79.160.57.239:48226]     django.setup(set_prefix=False) [Fri Jun 19 07:39:53.575392 2020] [wsgi:error] [pid 14184] [remote 79.160.57.239:48226]   File "/var/www/fplstats/fplstatsenv/lib/python3.6/site-packages/django/__init__.py",line 24,in setup [Fri Jun 19 07:39:53.575397 2020] [wsgi:error] [pid 14184] [remote 79.160.57.239:48226]     apps.populate(settings.INSTALLED_APPS) [Fri Jun 19 07:39:53.575403 2020] [wsgi:error] [pid 14184] [remote 79.160.57.239:48226]   File "/var/www/fplstats/fplstatsenv/lib/python3.6/site-packages/django/apps/registry.py",line 91,in populate [Fri Jun 19 07:39:53.575407 2020] [wsgi:error] [pid 14184] [remote 79.160.57.239:48226]     app_config = AppConfig.create(entry) [Fri Jun 19 07:39:53.575413 2020] [wsgi:error] [pid 14184] [remote 79.160.57.239:48226]   File "/var/www/fplstats/fplstatsenv/lib/python3.6/site-packages/django/apps/config.py",line 90,in create [Fri Jun 19 07:39:53.575418 2020] [wsgi:error] [pid 14184] [remote 79.160.57.239:48226]     module = import_module(entry) [Fri Jun 19 07:39:53.575424 2020] [wsgi:error] [pid 14184] [remote
79.160.57.239:48226]   File "/usr/lib/python3.6/importlib/__init__.py",line 126,in import_module [Fri Jun 19 07:39:53.575428 2020] [wsgi:error] [pid 14184] [remote
79.160.57.239:48226]     return _bootstrap._gcd_import(name[level:],package,level) [Fri Jun 19 07:39:53.575434 2020] [wsgi:error] [pid 14184] [remote 79.160.57.239:48226]   File "<frozen importlib._bootstrap>",line 994,in _gcd_import [Fri Jun 19 07:39:53.575441 2020] [wsgi:error] [pid 14184] [remote
79.160.57.239:48226]   File "<frozen importlib._bootstrap>",line 971,in _find_and_load [Fri Jun 19 07:39:53.575448 2020] [wsgi:error] [pid 14184] [remote 79.160.57.239:48226]   File "<frozen importlib._bootstrap>",line 953,in _find_and_load_unlocked [Fri Jun 19 07:39:53.575467 2020] [wsgi:error] [pid 14184] [remote
79.160.57.239:48226] ModuleNotFoundError: No module named 'channels'

频道已安装在虚拟环境中。

pip3显示频道:

Name: channels
Version: 2.4.0
Summary: Brings async,event-driven capabilities to Django. Django 2.2 and up only.
Home-page: http://github.com/django/channels
Author: Django Software Foundation
Author-email: foundation@djangoproject.com
License: BSD
Location: /home/marcus/.local/lib/python3.6/site-packages
Requires: daphne,Django,asgiref

为什么找不到频道模块?

iCMS 回答:使用apache部署Django频道-没有名为“频道”的模块

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2099879.html

大家都在问