Following "first app" tutorial -- admin site can't find css files

208 views
Skip to first unread message

Arthur

unread,
Dec 6, 2009, 9:18:37 PM12/6/09
to Django users
I'm using svn install. I am using the same virtualhost for django and
static files, with ADMIN_MEDIA_PREFIX set to '/media/', which I
believe was the default.

The admin app works fine so far, but the server gives me a 404 on the
css files:

Using the URLconf defined in testproject.urls,
Django tried these URL patterns, in this order:
^admin/
The current URL, media/css/base.css, didn't match any of these.

Can anyone help me with this problem? I really don't understand how
the ADMIN_MEDIA_PREFIX interacts with the urlconf settings.

Thank you,
Arthur


Waqqas Jabbar

unread,
Dec 6, 2009, 11:55:22 PM12/6/09
to django...@googlegroups.com
for test server i add the following lines in settings.py

import os
SITE_ROOT = os.path.realpath(os.path.dirname(__file__))

STATIC_DOC_ROOT = os.path.join(SITE_ROOT, 'media/')

and add the following lines in urls.py


if settings.DEBUG == True:
    urlpatterns += patterns('',(r'^site_media/(?P<path>.*)$', 'django.views.static.serve',{'document_root': settings.STATIC_DOC_ROOT}),)

and put all your media files in site_media folder


for my apache + mod_python setup i ve the following lines

<Location "/">
    PythonHandler django.core.handlers.modpython
    PythonPath "['c:/site',] + sys.path"
    SetEnv DJANGO_SETTINGS_MODULE hospital.settings
    SetHandler python-program
</Location>

<Locationmatch "^/(theme|media|site_media)/.*">
    SetHandler default
</Locationmatch>

alias /media/ H:/Python25/Lib/site-packages/django/contrib/admin/media/
alias /site_media/ c:/site/hospital/media/


"SetHandler default" should be after the "SetHandler python-program" in sequences



--

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



Reply all
Reply to author
Forward
Message has been deleted
0 new messages