Wednesday, June 1, 2011

Re: Django Admin static base.css ignored

This worked for me:

settings.py
--------------
STATIC_ROOT = '/path_to_my_project/static/'
STATIC_URL = '/static/'
STATICFILES_DIRS = ('/path_to_my_project/css/',)

STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

myproject/admin.py
-------------------------
class MyAdminClass(admin.ModelAdmin):
class Media:
css = {
"all": ("myproject.css",)
}

class Entity1Admin(MyAdminClass):
...

----------
Then put custom css in /path_to_my_project/css/myproject.css

References:
https://docs.djangoproject.com/en/dev/releases/1.3/#extended-static-files-handling
https://docs.djangoproject.com/en/dev/howto/static-files/

--
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