我相信我收到的错误是由于Django如何尝试提供静态文件。默认的天蓝色登陆页面有效,但是一旦我进入/ admin /,就会收到错误消息:
“您要查找的资源已被删除,其名称 更改,或暂时不可用”
这是来自Settings.py的静态文件信息:
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
#'/var/www/static/',
]
STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'static_cdn') //used in development
MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'media_cdn')//used in development
在D:\ home \ site \ wwwroot \ static中,我从这里的答案中获得了以下web.config:
IIS7, web.config to allow only static file handler in directory /uploads of website
编辑:
<configuration>
<system.webServer>
<handlers>
<add name="PythonHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
<add name="PythonHandler" path="*" verb="*" modules="FastCgiModule"
scriptProcessor="D:\home\python364x64\Scripts\pip3.exe"
resourceType="Unspecified" requireAccess="Script"/>
</handlers>
<httpPlatform processPath="D:\home\python364x64\python.exe"
arguments="D:\home\site\wwwroot\runserver.py --port %HTTP_PLATFORM_PORT%"
stdoutLogEnabled="true"
stdoutLogFile="D:\home\LogFiles\python.log"
startupTimeLimit="60"
processesPerApplication="16">
<environmentVariables>
<environmentVariable name="SERVER_PORT" value="%HTTP_PLATFORM_PORT%" />
</environmentVariables>
</httpPlatform>
<httpErrors errorMode="Detailed"></httpErrors>
</system.webServer>
<appSettings>
<add key="WSGI_HANDLER" value="django.core.wsgi.get_wsgi_application()"/>
<add key="PYTHONPATH" value="D:\home\python364x64\Scripts"/>
<add key="WSGI_LOG" value="D:\home\LogFiles\wfastcgi.log"/>
<add key="DJANGO_SETTINGS_MODULE" value="FTAData.settings" />
</appSettings>
</configuration>