I'm trying not to specify the full path of the web app in the settings to make it as portable as possible.
However,
with MEDIA_URL="/media/"
, an URL returned from a Django FileField model is http://localhost/media/....
with MEDIA_URL="//example.com/media/"
, the URL returned is http://example.com/media/....
But the schema (http/s) and domain (example.com) should match those of the requesting page. How can I do this?
The Django app is served through Nginx in combination with Gunicorn.