Sunday 15 February 2015

Django admin has no style -


I have just transferred my DJGenja site to my staging server, and the admin side of the site has a style with it Not before, when it was okay in the first local development, I have read somewhere that I need to make a symbolic link, I do this by

  sudo ln -s / var / www / sico / htdocs / Usr / lib / python2.5 / site-packages / django / contrib / admin /  

but he has not done anything that I can try ? Depending on your web server setup, you can do one of two ways:

Sealinking

In the original folder of your website, you should create a symbolic link to your Django administrator media directory, with the code name ADMIN_MEDIA_PREFIX your Django app's settings By default, this is / media / , so in your web root folder, the media is called a /usr/lib/python2.5/site-packages symlink Make . / Django / Contributing / Administrator / Media . (Note the trailing media at the end of the symlink, which is missing from your own example - Django Admin Media A media subdirectory in contrib / admin `).

Apache alias

If your production server is Apache, and you can change the root configuration, then you can set the path to mod_alias Django Admission Media For then, assuming that your ADMIN_MEDIA_PREFIX is / media / , you can set a nickname such as:

  & lt; VirtualHost *: 80 & gt; Aliases / Media / /usr/local/lib/python2.5/site-packages/django/contrib/admin/media/ & lt; / VirtualHost & gt;  

In this way, all requests under path / media / will be resolved in that directory.

Similar technology is present for most other servers, such as Lighttpd or nginx; If you do not use Apache then consult your server's documentation.


The solution to using Apache's mod_alias is probably best for deployment, but the synchronizing approach works just as well.

Your app is most likely the reason for working on your staging server because it was running from the internal web server of the Django, which can automatically resolve the path to the Admission Media Directory.


No comments:

Post a Comment