@Adarsh NA , Thanks for reaching out. I’m sorry to hear that you’re having trouble with media files in your Django project deployed.
- If you haven't done, you may leverage App Service diagnostics from Azure Portal> Navigate to your App Service app in the Azure Portal. In the left navigation, click on
Diagnose and solve problems
- Review - “Configuration and Management to fetch more details. - Browse to Kudu : http://”yoursitename”.scm.azurewebsites.net.
(for access the Kudu /media folder)
- Example: if your Azure App Service Web App name is “testwebapp”, then surf to http://testwebapp.scm.azurewebsite.net
- Click ‘Debug Console’ and select ‘CMD’
- Traverse to
wwwroot
folder
- Enable and review logs to fetch more details about the error: troubleshoot-diagnostic-logs#access-log-files
If you haven't done this already so, for App service (Windows).
- Set default list of MIME types: Media Files - HTTP 404 - Azure App Service on Windows
5.Use below line of code(at D:\home\site\wwwroot
using kudu console) to generate static file folder in Django app.
- -Add/Once you have static folder in
D:\home\site\wwwroot
folder. - -Navigate to Azure Portal and add a new section in
Virtual application and directories
underApplication Settings
with below values - -Navigate to
D:\home\site\wwwroot\static
folder and add web.config file with below - D:\home\site\wwwroot\static\web.config content
<?xml version="1.0"?>
<configuration>
<system.webServer>
<handlers>
<clear />
<add
name="StaticFile"
path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule"
resourceType="Either"
requireAccess="Read" />
</handlers>
</system.webServer>
</configuration>
Django app with HttpPlatformHandler in Azure App Services (Windows)
Kindly let us know how it goes, I'll follow-up with you.
If the answer helped (pointed, you in the right direction) > please click Accept Answer - it will help users to find the answers quickly.