Hi,
I have
ubuntu@myhost:~/oppia$ python3 --version
Python 3.6.3
(env) ubuntu@myhost:~/oppia/django-oppia$ python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
July 23, 2020 - 13:23:04
Django version 2.2.13, using settings 'oppiamobile.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
/etc/apache2/apache2.conf has this configuration
<VirtualHost *:89>
ServerName my.host.com
WSGIDaemonProcess localhost.oppia python-path=/home/ubuntu/oppia/django-oppia:/home/ubuntu/oppia/env/lib/python3.6/site-packages
WSGIProcessGroup localhost.oppia
WSGIScriptAlias / /home/ubuntu/oppia/django-oppia/oppiamobile/wsgi.py
WSGIPassAuthorization On
<Directory /home/ubuntu/oppia/django-oppia/oppiamobile/>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
Alias /media /home/ubuntu/oppia/media/
<Directory "/home/ubuntu/oppia/media/">
Options MultiViews FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Alias /static /home/ubuntu/oppia/static/
<Directory "/home/ubuntu/oppia/static/">
Options MultiViews FollowSymLinks
AllowOverride None
Require all granted
</Directory>
LogLevel warn
ErrorLog /var/log/apache2/oppia-error.log
CustomLog /var/log/apache2/oppia-access.log combined
</VirtualHost>
However, the error says:
==> /var/log/apache2/oppia-error.log <==
[Thu Jul 23 13:26:07.036985 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] mod_wsgi (pid=28987): Target WSGI script '/home/ubuntu/oppia/django-oppia/oppiamobile/wsgi.py' cannot be loaded as Python module.
[Thu Jul 23 13:26:07.037039 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] mod_wsgi (pid=28987): Exception occurred processing WSGI script '/home/ubuntu/oppia/django-oppia/oppiamobile/wsgi.py'.
[Thu Jul 23 13:26:07.037257 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] Traceback (most recent call last):
[Thu Jul 23 13:26:07.037331 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] File "/home/ubuntu/oppia/django-oppia/oppiamobile/wsgi.py", line 12, in <module>
[Thu Jul 23 13:26:07.037341 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] from django.core.wsgi import get_wsgi_application
[Thu Jul 23 13:26:07.037350 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] File "/usr/local/lib/python3.5/dist-packages/django/core/wsgi.py", line 2, in <module>
[Thu Jul 23 13:26:07.037355 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] from django.core.handlers.wsgi import WSGIHandler
[Thu Jul 23 13:26:07.037364 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/wsgi.py", line 6, in <module>
[Thu Jul 23 13:26:07.037369 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] from django.core.handlers import base
[Thu Jul 23 13:26:07.037388 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py", line 8, in <module>
[Thu Jul 23 13:26:07.037392 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] from django.urls import get_resolver, set_urlconf
[Thu Jul 23 13:26:07.037400 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] File "/usr/local/lib/python3.5/dist-packages/django/urls/__init__.py", line 1, in <module>
[Thu Jul 23 13:26:07.037404 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] from .base import (
[Thu Jul 23 13:26:07.037410 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] File "/usr/local/lib/python3.5/dist-packages/django/urls/base.py", line 9, in <module>
[Thu Jul 23 13:26:07.037414 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] from .exceptions import NoReverseMatch, Resolver404
[Thu Jul 23 13:26:07.037421 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] File "/usr/local/lib/python3.5/dist-packages/django/urls/exceptions.py", line 1, in <module>
[Thu Jul 23 13:26:07.037425 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] from django.http import Http404
[Thu Jul 23 13:26:07.037432 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] File "/usr/local/lib/python3.5/dist-packages/django/http/__init__.py", line 2, in <module>
[Thu Jul 23 13:26:07.037438 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] from django.http.request import (
[Thu Jul 23 13:26:07.037445 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] File "/usr/local/lib/python3.5/dist-packages/django/http/request.py", line 10, in <module>
[Thu Jul 23 13:26:07.037449 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] from django.core import signing
[Thu Jul 23 13:26:07.037456 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] File "/usr/local/lib/python3.5/dist-packages/django/core/signing.py", line 45, in <module>
[Thu Jul 23 13:26:07.037459 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] from django.utils.crypto import constant_time_compare, salted_hmac
[Thu Jul 23 13:26:07.037466 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] File "/usr/local/lib/python3.5/dist-packages/django/utils/crypto.py", line 6, in <module>
[Thu Jul 23 13:26:07.037470 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] import secrets
[Thu Jul 23 13:26:07.037489 2020] [wsgi:error] [pid 28987] [remote 103.69.247.73:17442] ImportError: No module named 'secrets'
I am unable to figure out following things:
- Why is apache pointing to 3.5 here /usr/local/lib/python3.5? Once this points to 3.6 , I believe âscretsâ error will be gone.
- Target WSGI script â/home/ubuntu/oppia/django-oppia/oppiamobile/wsgi.pyâ cannot be loaded as Python module.
This is coming even when I have wsgi installed and could verify:
wsgi_module (shared)
My machine is Ubuntu16.04 , running on a ec2 m5.large instance with python3.5 and python3.6 both installed.
Please advise.