英文:
django web server running with iis doesn't run static css js image files
问题
我有一个在ISP上运行的Django Web服务器项目,静态文件无法正常工作。
我如何修改Internet Information Services(IIS)和Web配置文件以使静态文件正常工作?
<?xml version="1.0" encoding="UTF-8">
<configuration>
<appSettings>
<!-- 必要的设置 -->
<add key="WSGI_HANDLER" value="django.core.wsgi.get_wsgi_application()" />
<!-- 你的Django路径 -->
<add key="PYTHONPATH" value="C:\inetpub\wwwroot\pax_web_server_app" />
<!-- 你的Django设置 -->
<add key="DJANGO_SETTINGS_MODULE" value="pax_web_server_app.settings" />
</appSettings>
<system.webServer>
<handlers>
<add name="paxsite" path="*" verb="*" modules="FastCgiModule" scriptProcessor="C:\Python311\python.exe|C:\Python311\Lib\site-packages/wfastcgi.py" resourceType="Unspecified" />
</handlers>
<staticContent>
<mimeMap fileExtension=".tab" mimeType="static/css" />
</staticContent>
</system.webServer>
</configuration>
我按照微软网站上的说明 进行了操作,但仍然无法正常工作。
英文:
I have a django web server project running on ISP and static file is not working
How do I make changes to Internet Information Services (IIS) and web cofig file for static files to work?
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<!-- Required settings -->
<add key="WSGI_HANDLER" value="django.core.wsgi.get_wsgi_application()" />
<!-- Your django path -->
<add key="PYTHONPATH" value="C:\inetpub\wwwroot\pax_web_server_app" />
<!-- Your djangoname.settings -->
<add key="DJANGO_SETTINGS_MODULE" value="pax_web_server_app.settings" />
</appSettings>
<system.webServer>
<handlers>
<add name="paxsite" path="*" verb="*" modules="FastCgiModule" scriptProcessor="C:\Python311\python.exe|C:\Python311\Lib\site-packages\wfastcgi.py" resourceType="Unspecified" />
</handlers>
<staticContent>
<mimeMap fileExtension=".tab" mimeType="static/css" />
</staticContent>
</system.webServer>
</configuration>
I did the instructions on the microsoft website but it still didn't work
答案1
得分: 0
创建名为static的IIS虚拟目录,并将该虚拟目录的路径指向您的实际静态文件夹。
以下是有关更多详细信息的链接:
https://stackoverflow.com/questions/32312590/how-to-fetch-static-css-files-with-django-on-iis
英文:
Create virtual directory in iis with the name of static and point the path to that virtual directory with your actual static folder
Here is the link you can refer for the more details:
https://stackoverflow.com/questions/32312590/how-to-fetch-static-css-files-with-django-on-iis
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论