我在 Stack Overflow 上读到了一些类似的问题,但仍然遇到这个问题。除了管理的 CSS 样式和所有 CSS 之外,Web Django 可以很好地部署在 IIS 上。
我尝试过的:
更多信息:
我使用了 findstatic 但没有得到另一个路径(在我的项目应用程序中收集静态路径) 它在我的 venv_ 包中?
如果您恢复与 FastCGI 相关的所有更改并使用 HttpPlatformHandler 干净地启动,您将看到体验是多么流畅,
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" requireAccess="Script" />
</handlers>
<httpPlatform stdoutLogEnabled="true" stdoutLogFile=".\python.log" startupTimeLimit="20" processPath="C:\Users\<user name>\AppData\Local\Programs\Python\Python310\python.exe" arguments=".\mysite\manage.py runserver %HTTP_PLATFORM_PORT%">
</httpPlatform>
</system.webServer>
</configuration>
Python/Django 仍然负责处理包括静态文件在内的所有事务,而 IIS/HttpPlatformHandler 只是传递请求。
更多详细信息可以从我的博客文章找到。