WebFaction
Community site: login faq
0
1

I am having the typical setup issues where I am unable to properly serve the css/js/img files for the admin pages. Can someone provide a video cast or screen shots to help ease the process of getting these frameworks up and running?

asked 27 Mar '12, 02:49

William Morgan
112
accept rate: 0%

edited 27 Mar '12, 05:03

From the Django project's 1.4 Release Notes:

Starting in Django 1.4, the admin's static files also follow this convention, to make the files easier to deploy. In previous versions of Django, it was also common to define an ADMIN_MEDIA_PREFIX setting to point to the URL where the admin's static files live on a Web server. This setting has now been deprecated and replaced by the more general setting STATIC_URL. Django will now expect to find the admin static files under the URL <static_url>/admin/.

If you've previously used a URL path for ADMIN_MEDIA_PREFIX (e.g. /media/) simply make sure STATIC_URL and STATIC_ROOT are configured and your Web server serves those files correctly. The development server continues to serve the admin files just like before. Read the static files howto for more details.

If your ADMIN_MEDIA_PREFIX is set to an specific domain (e.g. http://media.example.com/admin/), make sure to also set your STATIC_URL setting to the correct URL -- for example, http://media.example.com/.

(27 Mar '12, 14:00) Jaffa McNeill

I should also note that I had to go into my static folder and create a symlink over to the admin media files by

ln -s T /home/myname/webapps/django/lib/python2.7/django/contrib/admin/static/admin admin

This is probably all wrong, but it worked for me

(27 Mar '12, 14:41) Jaffa McNeill

do you have three apps or two for the basic django app + admin pages?

in other words: <myname-app>, static, media OR <myname-app>, static?

(27 Mar '12, 19:24) William Morgan

While we haven't yet updated our documentation for Django 1.4, I've followed our guide and it worked alright, as I can see the admin static files being properly served. You only need to make sure that you are running manage.py from it's new place, a directory back.

Please follow our guide, if you haven't done already, and comment any issues you might encounter.

permanent link

answered 27 Mar '12, 05:44

iliasr ♦♦
2.2k14
accept rate: 34%

After I go through the "updated" django screencast (updated for Django 1.1/mod_wsgi 2.5/python 2.5) I'm left with three apps:

  1. demo_paste app type - Django 1.4 (mod_wsgi 3.3/Python 2.7)
  2. media app type - Static only (no .htaccess)
  3. admin app type - Symbolic link to static-only app extra info - /home/[username]/webapps/demo_paste/lib/python2.7/django/contrib/admin/static/admin

Please look at the above and be sure that the symbolic link is correct because I attempted to modify the location for Django 1.4.

Then, when I go to the settings.py file I encounter the major issues. The settings.py file in Django 1.1 has a user defined admin_media_prefix variable whereas the settings.py file in Django 1.4 does not. I, along with others, seem to be perplexed about the existing apps and the settings.py structure.

In Django1.4, what exactly is the MEDIA_ROOT supposed to be? Is this where the admin app is supposed to link to? OR is this a static only app? If it's a static only app, then what exactly is the STATIC_ROOT supposed to be?

Coupled with the words chosen by webfaction in the original screencast(s), the changes in the Django framework make it confusing to get the framework up and running here.

(27 Mar '12, 13:11) William Morgan

Thanks for the feedback. Our Django documentation should now be better updated for Django 1.4 to obviate these issues.

(27 Mar '12, 22:03) ryans ♦♦

Same problem here. My setup was correctly working with Django 1.3.1, now I tried to upgrade to Django 1.4 using the same settings and I discovered that the settings for static files work well but admin static files [css] don't work at all. Reading the source of the webpage, I found this problem:

<link rel="stylesheet" type="text/css" href="/media/admin/admin/css/base.css"/> The correct one is, instead, href="/media/admin/css/base.css" It seems to me that /admin is now a sort of automatic add to the url for the admin static files, so previous setup can't work.
permanent link

answered 27 Mar '12, 16:42

Thrasher
111
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×52
×30
×20

question asked: 27 Mar '12, 02:49

question was seen: 5,103 times

last updated: 27 Mar '12, 22:03

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM