0

Getting a 500 Internal Server Error and find in the apache log that the channels module cannot be found.

Apache error log:

[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'

Channels is installed in the virtual environement.

pip3 show channels:

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

Why isn't the channels module found?

embe
  • 1,094
  • 2
  • 11
  • 25
  • 1
    You've installed the module `channels` at home. Apache could hardly find it there. My advice is to create a virtualenv that Apache can access and install everything in it. – phd Jun 19 '20 at 13:12
  • I though that location was because of a symlink but your comment made me look deeper. That location is actually the result of pip3 show channels when the virtualenv is activated, but shouldn't it show packages inside the virtualenv when is activated!? "var/www/fplstats/fplstatsenv/bin/python -m pip install -r requirements.txt" did actually install the packages inside the virtualenv and guess what..... it is working now. Thanks phd. – embe Jun 19 '20 at 18:42

0 Answers0