1、Python版本:Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)] on win32
2、Apache版本:Server version: Apache/2.4.53 (Win32)
3、Django版本:print(django.VERSION)
(2, 2, 0, 'final', 0)
#-----Wsgi模块配置------
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sn_ued.settings')
application = get_wsgi_application()
#-----Django 配置------
# 1.安装wsgi模块后,出来的三行字符,直接复制过来
LoadFile "d:/program files/python/python36-32/python36.dll"
LoadModule wsgi_module "d:/program files/python/python36-32/lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win32.pyd"
WSGIPythonHome "d:/program files/python/python36-32"
# 声明项目根目录变量
Define DjangoRoot "D:/pyhon_data/python/SN/sn_ued"
#设置工程中的wsgi路径
WSGIScriptAlias / "${DjangoRoot}/sn_ued/wsgi.py"
# 3.设置工程路径
WSGIPythonPath "${DjangoRoot}"
<Directory "${DjangoRoot}">
<RequireAll>
Require all granted
</RequireAll>
</Directory>
#设置wsgi路径
<Directory "${DjangoRoot}/sn_ued">
<Files wsgi.py>
Require all granted
</Files>
</Directory>
#设置静态文件路径
# Alias /static "D:/Work Data/Python Data/Static Local/sn_ued"
Alias /file "D:/Work Data/Python Data/Static Local/sn_ued"
<Directory "D:/Work Data/Python Data/Static Local/sn_ued">
Require all granted
</Directory>
Alias /static "${DjangoRoot}/static"
<Directory "${DjangoRoot}/static">
AllowOverride all
Options None
Require all granted
</Directory>
WSGIApplicationGroup %{GLOBAL}
Apache Service Monitor 已成功打开
但是打开页面设置的网页,显示Internal Server Error
查看Apache error.log ,问题代码如下
child process 20196
[core:warn] [pid 20196:tid 552] AH00111: Config variable ${DjangoRoot} is not defined
[core:warn] [pid 20196:tid 552] AH00111: Config variable ${DjangoRoot} is not defined
[core:warn] [pid 20196:tid 552] AH00111: Config variable ${DjangoRoot} is not defined
[core:warn] [pid 20196:tid 552] AH00111: Config variable ${DjangoRoot} is not defined
[core:warn] [pid 20196:tid 552] AH00111: Config variable ${DjangoRoot} is not defined
[core:warn] [pid 20196:tid 552] AH00111: Config variable ${DjangoRoot} is not defined
[mpm_winnt:notice] [pid 20196:tid 552] AH00354: Child: Starting 64 worker threads.
[wsgi:error] [pid 20196:tid 1848] mod_wsgi (pid=20196): Failed to exec Python script file 'D:/pyhon_data/python/SN/sn_ued/sn_ued/wsgi.py'.
[wsgi:error] [pid 20196:tid 1848] mod_wsgi (pid=20196): Exception occurred processing WSGI script 'D:/pyhon_data/python/SN/sn_ued/sn_ued/wsgi.py'.
[wsgi:error] [pid 20196:tid 1848] Traceback (most recent call last):\r
[wsgi:error] [pid 20196:tid 1848] File "D:/pyhon_data/python/SN/sn_ued/sn_ued/wsgi.py", line 12, in <module>\r
[wsgi:error] [pid 20196:tid 1848] from django.core.wsgi import get_wsgi_application\r
[wsgi:error] [pid 20196:tid 1848] File "d:\\program files\\python\\python36-32\\lib\\site-packages\\django\\core\\wsgi.py", line 2, in <module>\r
[wsgi:error] [pid 20196:tid 1848] from django.core.handlers.wsgi import WSGIHandler\r
[wsgi:error] [pid 20196:tid 1848] File "d:\\program files\\python\\python36-32\\lib\\site-packages\\django\\core\\handlers\\wsgi.py", line 8, in <module>\r
[wsgi:error] [pid 20196:tid 1848] from django.core.handlers import base\r
[wsgi:error] [pid 20196:tid 1848] File "d:\\program files\\python\\python36-32\\lib\\site-packages\\django\\core\\handlers\\base.py", line 8, in <module>\r
[wsgi:error] [pid 20196:tid 1848] from django.urls import get_resolver, set_urlconf\r
[wsgi:error] [pid 20196:tid 1848] File "d:\\program files\\python\\python36-32\\lib\\site-packages\\django\\urls\\__init__.py", line 1, in <module>\r
[wsgi:error] [pid 20196:tid 1848] from .base import (\r
[wsgi:error] [pid 20196:tid 1848] File "d:\\program files\\python\\python36-32\\lib\\site-packages\\django\\urls\\base.py", line 6, in <module>\r
[wsgi:error] [pid 20196:tid 1848] from django.utils.translation import override\r
[wsgi:error] [pid 20196:tid 1848] File "d:\\program files\\python\\python36-32\\lib\\site-packages\\django\\utils\\translation\\__init__.py", line 7, in <module>\r
[wsgi:error] [pid 20196:tid 1848] from django.utils.autoreload import autoreload_started, file_changed\r
[wsgi:error] [pid 20196:tid 1848] File "d:\\program files\\python\\python36-32\\lib\\site-packages\\django\\utils\\autoreload.py", line 18, in <module>\r
[wsgi:error] [pid 20196:tid 1848] from django.apps import apps\r
[wsgi:error] [pid 20196:tid 1848] ImportError: cannot import name 'apps'\r
目前发现了3除报错
1、AH00111: Config variable ${DjangoRoot} is not defined
2、Failed to exec Python script file 'D:/pyhon_data/python/SN/sn_ued/sn_ued/wsgi.py'.
3、[wsgi:error] [pid 20196:tid 1848] from django.apps import apps\r
[wsgi:error] [pid 20196:tid 1848] ImportError: cannot import name 'apps'\r
刚入门,都是按照csdn的手册一步一步操作的,求解,这个到底是什么问题导致的。是我配置的wgsi模块有问题,还是其他的什么问题啊?