Electronics & Programming


Open Source electronics development and programming

  • You are not logged in.

#1 Dec. 1, 2010 12:41:42

Emanuel V.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

problem with media

Hi all!

I've recently updated my django version and now all my projects doesn't have
css and js from admin or from my apps

I've started new projects and it simply doesn't work

I've googled and I find out when we are using the deveopment server the
static files from admin should be server automatticly and yet doesn't work.

>From my own apps I'm using the django.contrib.staticfiles app and my old
code doesn't work.

My settings.py have this code:

import os
PROJECT_ROOT = os.path.dirname(__file__)
ROOT_DIR = os.path.dirname(PROJECT_ROOT)
MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')
MEDIA_URL = '/s/media/'
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
STATIC_URL = '/s/static/'
ADMIN_MEDIA_PREFIX = '/static/admin/'
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
# 'django.template.loaders.eggs.Loader',
os.path.join(PROJECT_ROOT, 'templates'),

My urls.py have this code:
urlpatterns += staticfiles_urlpatterns()

#This was the old version:
#if settings.DEBUG:
#urlpatterns += patterns('django.contrib.staticfiles.views',
#(r'^%s(?P<path>.*)' % settings.STATIC_URL, 'serve',
{'document_root': 'sss'}),#settings.STATIC_ROOT

Before I realized that the admin was also with the same problem, I've edited
the django.contib.static.serve where I put a print statement like this:
print "%s -- %s" $ (path, document_root)
The result was:
/css/main.css -- None
I guess that the var document_root it's not being sent. I don't know...

Thanks in advanced

You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.


Board footer

Moderator control

Enjoy the 24th of March

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support