A 500 response will generally come from your service. If your logs aren’t telling you why this is happening you may need to increase the log level, turn on debug mode or add your own additional debug logs.
It seems that your debug settings might be toggling certain features in your app settings, causing it to be unprepared to handle traffic or even launch in a non-DEBUG mode. You’re using Django, aren’t you? Before anything else, try running your app locally without DEBUG mode. Review your settings.py file and ensure your conditional statements are accurate and connecting to the resources you intend to.