Le 8 oct. 2011 à 15:27, Markus Gattol a écrit :
Here's what I think is semantically good distinction:PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) (that's the dir containing your settings.py, that dir is usually one dir below your virtualenv, I simply name it "pr". You can then use PROJECT_ROOT to reference such as:STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static_root')STATIC_URL = '/static/'STATICFILES_DIRS = (os.path.join(PROJECT_ROOT, 'static/css'),os.path.join(PROJECT_ROOT, 'static/img'),os.path.join(PROJECT_ROOT, 'static/js'),)STATICFILES_FINDERS = ('django.contrib.staticfiles.finders.FileSystemFinder','django.contrib.staticfiles.finders.AppDirectoriesFinder',)PROJECT_ROOT, "pr" on the filesystem is what you get when you run django-admin.py startproject pr after you run mkvirtualenv foo.com (foo.com would then be the root of your virtualenv; some also call it SITE_ROOT in Django context because they keep web server config, Sass files, etc. there). Here's the dir structure I came to enjoy, also because it maps nicely to the settings posted above:
Hi,
Your STATICFILES_DIRS should not be set to static.
Create a new theme directory, put your files there and update your STATICFILES_DIRS.
Have a look at http://www.linovia.com/blog/django-staticfiles-troubleshooting/ for an example.
Regards,
Xavier.
No comments:
Post a Comment