views:

265

answers:

1

Hi!

I am trying to serve static files from another domain (sub domain of current domain). To serve all media files I used this settings:

MEDIA_URL = 'http://media.bud-inform.co.ua/'

So when in template I used

{{ MEDIA_URL }}

it was replace with the setting above. Now I am trying to serve admin media files from the same subdomain, I changed the settings this way:

ADMIN_MEDIA_PREFIX = 'http://media.bud-inform.co.ua/admin%5Fmedia/',

and expected that all calls to media from my admin site will be made to this url.... But actually it didn't work this way, I still see paths to CSS made as following:

http://bud-inform.co.ua/media/css/login.css

Could you suggest how to serve admin media files correctly

A: 

MEDIA_URL and ADMIN_MEDIA_PREFIX are two different things. One is the location of your media files, while the other is the location of the django admin system's media files.

You have to make sure that the ADMIN_MEDIA_PREFIX points to somewhere where you're actually serving the admin media. Django doesn't handle that step for you.

The django admin media is at django/contrib/admin/media/. Copy or symlink that directory somewhere publicly visible and set ADMIN_MEDIA_PREFIX to reflect where you put it.

tylerl
Yes that directory is definitely visible from ADMIN_MEDIA_PREFIX url.The problem is that: ADMIN_MEDIA_PREFIX = 'http://media.bud-inform.co.ua/admin%5Fmedia/',And in admin I see paths like this: http://bud-inform.co.ua/media/css/login.css, when expected to see something like http://media.bud-inform.co.ua/admin%5Fmedia/css/login.css',
Oleg Tarasenko