Question

I have created a Django project in local which runs without any kind of problem. But, after an annoying and difficult Cherokee + uWSGI installation on Amazon AWS, my project does not show Django .css internal files.

http://f.cl.ly/items/2Q2W3I3R0X1n2X3v0q2P/django_error.jpg <-- /Admin/ looks like this

The image is a screen of my /admin/, which should have a different style, but .css files are not loaded.

[pid: 23206|app: 0|req: 19/19] 83.49.10.217 () {56 vars in 1121 bytes} [Sun Apr 15      05:50:24 2012] GET /static/admin/css/base.css => generated 2896 bytes in 6 msecs (HTTP/1.1 404) 1 headers in 51 bytes (1 switches on core 0)

[pid: 23206|app: 0|req: 20/20] 83.49.10.217 () {56 vars in 1125 bytes} [Sun Apr 15 05:50:24 2012] GET /static/admin/css/login.css => generated 2899 bytes in 5 msecs (HTTP/1.1 404) 1 headers in 51 bytes (1 switches on core 0)

This is a log from Cherokee. I don't understand why it is looking for the .css files in that path. Cherokee should be searching the files in Django original directory so I didn't change .css files in my project.

Any advice? Thanks a lot.

Was it helpful?

Solution

It sounds like you're using Django 1.4 in which this is the expected behavior.

Checkout the Backwards incompatible changes section in release notes:

The included administration app django.contrib.admin has for a long time shipped with a default set of static files such as JavaScript, images and stylesheets. Django 1.3 added a new contrib app django.contrib.staticfiles to handle such files in a generic way and defined conventions for static files included in apps.

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 /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/.*

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top