Forgive top posting - I can't debug your code but I can show you what I
do (an excerpt from my settings.py) to debug my own using print
statements. I use PROJECT as the project name and PROJECT_ROOT to
contain SRC_ROOT which contains settings.py
...
MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'htdocs/media/').replace('\\','/')
if DEBUG: print('MEDIA_ROOT = %s %s' % (MEDIA_ROOT, '(images etc)'))
MEDIA_URL = '/media/'
if DEBUG: print('MEDIA_URL = <website>%s (serve images)' %
MEDIA_URL)
ADMIN_MEDIA_PREFIX = '/static/admin/'
STATICFILES_DIRS = (
os.path.join(SRC_ROOT, 'static/').replace('\\','/'),
os.path.join(SRC_ROOT, 'company/static/').replace('\\','/'),
)
if DEBUG:
i = 0
for item in STATICFILES_DIRS:
i += 1
print('STATICFILES_DIRS#%s = %s' % (i, item ))
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
if DEBUG:
STATIC_ROOT = os.path.join(PROJECT_ROOT,
'htdocs/static/').replace('\\','/')
print('STATIC_ROOT = %s %s' % (STATIC_ROOT, '(collectstatic)'))
else:
STATIC_ROOT = '/srv/www/%s/htdocs/static/' % PROJECT
STATIC_URL = '/static/'
if DEBUG:
print('STATIC_URL = <website>%s (to serve css etc)' %
STATIC_URL)
...
I must say I had difficulty figuring things out as well until I could
see exactly what was happening
Good luck
Mike
On 8/11/2011 2:57pm, M. Herold wrote:
By the way, I'm trying to get this URI to work:
http://mysite/static/css/style.css
On Nov 7, 9:55 pm, "M. Herold"<digitallim...@gmail.com> wrote:
This is driving me insane. I've done it what feels like 6 different
ways and for whatever reason, none of them appear to work. The worst
part is it's something so simple: I want to link to a css file on my
system. Why does this have to be so ridiculous before I get the
project into production? Here are the two tutorials that seem the most
relevant:
https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:se...
http://stackoverflow.com/questions/446026/django-how-do-you-serve-med...
And here's what I have:
settings.py
STATIC_ROOT = '/Users/digitallimit/DjangoProjects/mherodev/'
STATIC_URL = '/static/'
ADMIN_MEDIA_PREFIX = '/static/admin'
STATICFILES_DIRS = (
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
urls.py
if settings.DEBUG:
urlpatterns += patterns('',
(r'^static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.STATIC_ROOT}),
)
Worst cast, I'll just embed the CSS directly, but this is silly. It
should be the easiest thing in the world.
--
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+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.