整体步骤:
1、下载apache,安装apache,保证本地可以正常访问,提示it worked即可。
2、下载mod_wsgi,用pip安装好。
3、修改httpd.conf文件:
修改配置文件里的url为自己django项目的url,具体百度有。文件最后面添加如下:
LoadFile "d:/python3/python36.dll"
LoadModule wsgi_module "d:/python3/lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win_amd64.pyd"
WSGIPythonHome "d:/python3"
#指定项目的wsgi.py配置文件路径,这个py文件是在你的Django项目中
WSGIScriptAlias / d:\gantt\gantt\wsgi.py
#指定项目目录,即你的Django项目路径
WSGIPythonPath D:\gantt
#配置wsgi.py的访问权限
<Directory d:\gantt\gantt>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
#项目静态文件地址, Django项目中静态文件的路径
Alias /static D:\gantt\gantt_app\static
<Directory D:\gantt\gantt_app\static>
AllowOverride None
Options None
Require all granted
</Directory>
4、django项目的---setting文件,修改host为['*'],DEBUG不用改,改了貌似访问不了了
5、本地可以访问,局域网访问不了:
httpd.conf里的,
Listen 0.0.0.0:8089
Directory />
AllowOverride all
Require all granted
</Directory>