Hi @Cornelis Buitelaar
Welcome to MS Q&A platform.
A 502 Bad Gateway error in your Django app on Azure App Service usually means there's a problem with the backend or configuration.
- Head over to the Kudu console.
- Look at the logs in the LogFiles directory for any error messages or stack traces.
- Make sure your Django app has the correct startup command in the Azure Portal under App Service > Configuration > General settings > Startup Command.
- Check that all necessary environment variables, like DATABASE_URL and secrets from Azure Key Vault, are set correctly.
- High memory or CPU usage can cause 502 errors. Use the Monitoring tools in the Azure Portal to check resource usage.
- If resources are tight, consider scaling up your App Service Plan.
- Ensure health probes are set up correctly to monitor the app's health endpoints. Misconfigurations can mark the backend as unhealthy, leading to 502 errors.
ref:
https://learn.microsoft.com/en-us/azure/app-service/troubleshoot-http-502-http-503
https://learn.microsoft.com/en-us/answers/questions/2147533/azure-502-bad-gateway-issue
Let me know if you have any further assistances.
If the answer is helpful, please click Accept Answer and kindly upvote it so that other people who faces similar issue may get benefitted from it.