Depending on your web server setup, you can do it one of two ways:
Symlinking
In your website's root folder, you should create a symbolic link to your Django admin media directory, with the name name as the ADMIN_MEDIA_PREFIX
in your Django app's settings. By default this is /media/
, so in your web root folder, create a symlink called media
to /usr/lib/python2.5/site-packages/django/contrib/admin/media
. (Note the trailing media
on the end of the symlink, which is missing from your own example -- the Django admin media is located in a media
subdirectory in
contrib/admin`).
Apache Alias
If your production server is Apache, and you can change the root configuration, you can use mod_alias
to set up the path to Django admin media. Again, assuming that your ADMIN_MEDIA_PREFIX
is /media/
, you can set up an alias like so:
<VirtualHost *:80>
Alias /media/ /usr/local/lib/python2.5/site-packages/django/contrib/admin/media/
</VirtualHost>
This way, all requests under the path /media/
will be resolved to that directory.
A similar technique exists for most other servers, such as Lighttpd or nginx; consult your server's documentation if you don't use Apache.
The solution using Apache's mod_alias
is probably best for deployment, but the symlinking approach works just as well too.
The reason your app worked on your staging server is most likely because it was running with Django's internal web server, which can automatically resolve the path to the admin media directory.