Trying to run Django App along with Apache2 in Python3.8 Virtual environment. When I enter in to the python shell, I could import django. But when accessing webpage, it says "django not found"
As per the /var/log/apache2/error.log, following is the error
[Sun May 03 02:56:14.209910 2020] [wsgi:error] [pid 21516] [remote 192.168.1.5:58968] from django.core.wsgi import get_wsgi_application [Sun May 03 02:56:14.209966 2020] [wsgi:error] [pid 21516] [remote 192.168.1.5:58968] ModuleNotFoundError: No module named 'django'
wsgi.py:
import os,sys
sys.path.append('/var/www/html/django-venv-py3.8/lib/python3.8/site-packages')
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'filebucket.settings')
application = get_wsgi_application()
default.conf
(django-venv-py3.8) ramesh@Orktion:.../filebucket$ cat /etc/apache2/sites-available/000-default.conf
<Directory /var/www/html/django-venv-py3.8/filebucket/filebucket>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess filebucket python-path=/var/www/html/django-venv-py3.8/filebucket python-home=/var/www/html/django-venv-py3.8
WSGIProcessGroup filebucket
WSGIScriptAlias / /var/www/html/django-venv-py3.8/filebucket/filebucket/wsgi.py
Alias /static /var/www/html/django-venv-py3.8/filebucket/static
<Directory /var/www/html/django-venv-py3.8/filebucket/static>
Require all granted
</Directory>
Alias /media /var/www/html/django-venv-py3.8/filebucket/media
<Directory /var/www/html/django-venv-py3.8/filebucket/media>
Require all granted
</Directory>
I have followed some troubleshooting articles, but no luck
try to install Django
using the following command in windows CMD, and then try to execute it again: python -m django
I hope this works:)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.