Hello All,

I am currently building a website using the Django built-in
development server (python manage.py runserver).  I have been using
the main djangoproject tutorial for this, and it has worked very
well.  I have added a lot of internal CSS to the HTML templates that
make up my project's views, and it works fine as such, but when I try
to move the CSS into external files and link to it from the templates,
it doesn't work (the views load up style-free).

What follows are my current settings.  In settings.py, I have:

STATIC_URL = '/static/'
INSTALLED_APPS = ('django.contrib.staticfiles',)

In urls.py, I have:

from django.conf.urls.defaults import *
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    (r'^home/$','myapp.views.homepage'),
    (r'^admin/', include(admin.site.urls)),
)

urlpatterns += staticfiles_urlpatterns()

And in my HTML template, I have:

<link rel="stylesheet" href="{{ STATIC_URL }}stylesheet.css"
type="text/css" />

The file "stylesheet.css" is located inside a folder called "static",
which is inside the "myapp" folder, which is inside the main project
folder.

I would like to stress that I have already read djangoproject's
documentation on static files, and have done my best to follow the
instructions there, but with no success.  I suspect this is because I
am missing a step somewhere that isn't explicitly mentioned in either
the main tutorial or the static file docs.  As such, I think I need
some kind of basic how-to for linking to static files and making them
work while running the project on the development server.

Could anyone either point me towards a good tutorial or volunteer a
set of dummy-proof instructions on how to do this?  I imagine it must
be relatively simple--I'm not trying to gather my static files for
deployment or production or anything, I just want to be able to test
CSS and JS files in development.  But I think I'm missing some basic
step--maybe a console command or something?

thanks,
Guillaume Chorn

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

Reply via email to