只需要在 apache 的配置文件中加入 WSGIPassAuthorization On 即可
配置如下:
LoadFile "d:/python/python36.dll"
LoadModule wsgi_module "d:/python/lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win_amd64.pyd"
WSGIPythonHome "d:/python"
#设置工程中的wsgi路径
WSGIScriptAlias / d:\django\gateServer\gateServer\wsgi.py
#设置工程路径
WSGIPythonPath d:\django\gateServer
WSGIPassAuthorization On # 关键:可以获取 authorization
#设置wsgi路径
<Directory d:\django\gateServer\gateServer>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
#设置静态文件路径
Alias /static D:\django\gateServer\templates\static
<Directory D:\django\gateServer\templates\static>
AllowOverride None
Options None
Require all granted
</Directory>