1

I have a blog made with Django (and Django-CMS). Some times, when working in development, I make some changes and it would be nice to see how those changes that I'm doing look like with the actual media files that I have in production.

So today I tried to set the MEDIA_URL and the MEDIA_ROOT settings to be the actual media URL of my production site. i.e:

MEDIA_URL = 'https://example.com/media/'
MEDIA_ROOT = 'https://example.com/media/'

I was naively hoping to see the media files of production in development after doing this, but nope, it didn't work.

I also tried to do the the typical extending of urlpatterns list. i.e:

urlpatterns = [
    # ... the rest of your URLconf goes here ...
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

But then I read in the docs that it is useless to do that if the given prefix (MEDIA_URL) is an URL (as in my case).

Aditional info: My site is hosted by PythonAnywhere, and they (pythonanywhere) serve the media files as well. The files are all public. I use django-filer as my file manager. One sample of my media files: media file

Anyway, is this possible to achieve? If so, what am I missing?

revliscano
  • 2,227
  • 2
  • 12
  • 21

0 Answers0