正在尝试在Python3.8虚拟环境中运行Django应用程序和Apache2。当我进入pythonshell时,我可以导入django。但当访问网页时,会显示“django未找到”
根据/var/log/apache2/error.log,以下是错误
[Sun May 03 02:56:14.209910 2020][wsgi:error][pid 21516][remote 192.168.1.5:58968]来自django.core.wsgi导入获取wsgi应用程序 [Sun May 03 02:56:14.209966 2020][wsgi:error][pid 21516][remote 192.168.1.5:58968]ModuleNotFoundError:没有名为'django'的模块
wsgi.py:
导入操作系统,系统
sys.path.append(“/var/www/html/django-venv-py3.8/lib/python3.8/site packages”)
从django.core.wsgi导入获取\u wsgi\u应用程序
os.environ.setdefault('DJANGO\u SETTINGS\u MODULE','filebucket.SETTINGS')
application=get\u wsgi\u 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>
我已经阅读了一些疑难解答文章,但运气不好
尝试在windows CMD中使用以下命令安装
Django
,然后再次尝试执行该命令:python -m django
我希望这能奏效:)
相关问题 更多 >
编程相关推荐