I have two separate servers. One is hosting django instance on "www.example.com"
, the other is serving static files on "static.example.com"
. In django settings, MEDIA_URL
points to "static.example.com"
. Therefore my photologue is using the "static.example.com"
domain.
I want to use "www.example.com"
for my photologue, but I can't figure out how I can override the MEDIA_URL
setting for the photologue. Do you know any way to solve this?
Note: Django is serving over apache, Static files hosted on AWS (Amazon Web Service). I just want to change only photologue domain. Other static files must stay where they are.
Unfortunately Photologue doesn't provide a setting for this.
But looking at the code I found a workaround that should do the trick. I assume you use the
get_SIZE_url()
methods. All of those methods callself.cache_url()
. So, you could create a subclass ofImageModel
(orPhoto
if you want to have the functionality that comes with it) which overrides this method.If you extended
Photo
you already have a workingget_absolute_url()
otherwise an implementation is straight forward.Django admin uses
get_admin_thumbnail_url()
so if you define aPhotoSize
with name 'admin_thumbnail' the above method should work there too.Effects have a method
sample_url()
used to show the effect on a sample image in Django admin. This method is based onMEDIA_URL
so it won't work. Unfortunately in this case you cannot simply override this method. But since these images won't change you could upload them to AWS.