Sunday, January 2, 2011

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

Hi Arthur,

Thanks for your post. It was one of the first I found perfectly aligned with my current issue: showing the look & feel one would expect, while following the official django tutorial at http://docs.djangoproject.com/en/dev/intro/tutorial02/ using django's default development server.

After looking around for the replies on this post and other similar questions on the web, I was able to fix this with these 4 actions:
  1. Make sure you have the following lines in settings.py:
    • MEDIA_ROOT = os.path.join(os.path.dirname(__file__), "media")
    • MEDIA_URL = '/media/'
    • ADMIN_MEDIA_PREFIX = '/media/admin/'
  2. Add the following line to urls.py, as an extra parameter inside the patterns function call
    • # Required to make static serving work 
    • (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
  3. Build a directory structure to the above settings
  4. And, finally, copy the default admin CSS files from the django installation onto the above structure (in my case the django CSS files were in C:\django\django\contrib\admin\media\css)

Also, it helped me a lot to read these posts in the web:
Have fun,
Pedro

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

No comments:

Post a Comment