Note that there are some explanatory texts on larger screens.

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

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload