I have a django application deployed on an AWS IIS server. Static fils are served just fine via 'runserver', but not via the IIS server. I have done everything right but it doesn't work. i even tried adding a static folder virtual directory but it didnt work. this is my webconfig:
<?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:\myvenv2\NutMIS" />
<!-- Your djangoname.settings -->
<add key="DJANGO_SETTINGS_MODULE" value="NutMIS.settings" />
</appSettings>
<system.webServer>
<handlers>
<!-- Remove duplicate entries -->
<remove name="NutMIS" />
<remove name="StaticFiles" />
<remove name="StaticFile" />
<!-- Add handler for StaticFiles -->
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule" resourceType="Unspecified" requireAccess="Read" />
<!-- Add your custom NutMIS handler -->
<add name="NutMIS" path="*" verb="*" modules="FastCgiModule" scriptProcessor="C:\Users\Administrator\AppData\Local\Programs\Python\Python311\python.exe|C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" />
</handlers>
<staticContent>
<mimeMap fileExtension=".*" mimeType="application/octet-stream" />
</staticContent>
</system.webServer>
</configuration>
this is my settings:
STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR / "static"
The static files feature is installed in my IIS. My 'static' folder is placed in the app folder and it works just fine via runserver but not via the public IP over IIS. Please i need help with this.
i also tried adding this web.config to to my static file folder but it didnt work:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<!--
This removes Helicon Zoo handler and makes IIS processing static files.
-->
<remove name="django.project#x64" />
<remove name="django.project#x86" />
</handlers>
</system.webServer>
</configuration>