Thomas and Lokesh, Thanks very much for your help. I've modified the link in my HTML file to be:
<link rel="stylesheet" type="text/css" href={{ STATIC_URL }}stylesheet.css /> where "stylesheet" is the name of the CSS file, and this file is located inside the directory listed under STATIC_DIRS in my settings.py file. As mentioned in my prior email, I also already have STATIC_URL = '/static/' in my settings.py file, and I have the correct methods listed under STATICFILES_FINDERS. But it is still not working. Do I have a syntax error somewhere? Or am I still missing something in another file? thanks, Guillaume On Mon, Aug 1, 2011 at 6:45 PM, Thomas Orozco <g.orozco.tho...@gmail.com>wrote: > If your css file is locatedr in your staticfiles dir, you should use > something such as {{ STATIC_URL }}main.css, assuming your CSS file is called > main and is located in one of the STATIC_DIRS. > > Using staticfiles_dirs in a template makes no sense. Not only your are > passing a parameter that has to do with your system configuration and not > your urls, but you are also using a directory instead of a file. > > In short, it is the static_url parameter that should be passed to form a > URL. > Le 1 août 2011 12:17, "Gchorn" <guillaumech...@gmail.com> a écrit : > > > Hello All, > > > > I'm using Django to develop a website, and I'm having trouble getting > > it to see my static files. I've looked through Django's static file > > documentation and the steps I've taken to get Django to see my files > > (using a CSS file as an example) are as follows: > > > > First, I created a folder called "static" inside the main app folder > > for this project. Then, I added "/static/" to the STATIC_URLS section > > of the settings.py file, and I also added the full path to my CSS file > > under the STATICFILES_DIRS section of settings.py. > > > > Then I added the line: > > > > from django.template import RequestContext, loader > > > > As well as "context_instance= RequestContext(request)" as a third > > argument to the "return render_to_response()" call. > > > > Finally, in my url.py file, I added this line at the top: > > > > from django.contrib.staticfiles.urls import staticfiles_urlpatterns > > > > And this line at the bottom (separate from the initial "urlpatterns = > > patterns()" call): > > > > urlpatterns += staticfiles_urlpatterns() > > > > In my HTML/Django template, I added the following link to my CSS file: > > > > <link rel="stylesheet" type="text/css" href={{ STATIC_DIRS }} /> > > > > But then after all of this, when I perform a "python manage.py > > runserver" to preview the website, Django still does not appear to > > find the external CSS file. I must still be missing something but I'm > > not sure what--does anyone know??? > > > > I'm sure I'm missing something very basic but I'm a total beginner so > > please be patient with me, I probably need a lot of very specific > > instructions... > > > > thanks, > > Guillaume > > > > -- > > 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. > > > > -- > 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. > -- 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.