Hi, you should conform the django.contrib.staticfiles in your
INSTALLED_APPS, then add the prefix to your template:{% load static %},

On Thursday, August 4, 2011, Guillaume Chorn <guillaumech...@gmail.com>
wrote:
> Hi All,
>
> It's been a couple of days since I last wrote and no response so I'm
trying again (see below).  Please help if you can; without being able to
link to external static files I really can't do anything else with my site.
CSS is the very least of my concerns--worst case I can include that info in
each HTML file--but I need to be able to use some basic javascript for my
site and right now, because of this issue, I can't even do that.  Is there
anyone who could help me troubleshoot this?  Anyone??
>
> thanks,
> Guillaume
>
> On Wed, Aug 3, 2011 at 12:20 PM, Guillaume Chorn <guillaumech...@gmail.com>
wrote:
>
> Ok, so I did use quotes in my link, and I changed my STATIC_URL setting
(in settings.py) from '/static/' to 'http://127.0.0.1:8000/static/' (I am
currently using the built-in development server at this address), but still
no luck.
>
> I'm not sure exactly what you mean by my "staticfiles settings."  (Sorry,
once again I'm a total beginner so please bear with me.)  My current
settings related to static files in 'settings.py' are as follows:
>
> STATIC_ROOT = ''
> STATIC_URL = 'http://127.0.0.1:8000/static/'
> ADMIN_MEDIA_PREFIX = '/static/admin/'
> STATICFILES_DIRS =
('/Users/guillaumechorn/Documents/website/mainapp/static')
> STATICFILES_FINDERS = (
>     'django.contrib.staticfiles.finders.FileSystemFinder',
>     'django.contrib.staticfiles.finders.AppDirectoriesFinder'
> )
>
> Below are the full contents of my urls.py file:
>
> 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/$','mainapp.views.homepage'),
>     (r'^mainapp/$','mainapp.views.index'),
>     (r'^mainapp/(?P<company_id>\d+)/$', 'mainapp.views.detail'),
>     (r'^products/$','mainapp.views.productindex'),
>     (r'^products/(?P<product_id>\d+)/$','mainapp.views.productdetail'),
>     (r'^news/$','mainapp.views.news'),
>     (r'^events/(?P<event_id>\d+)/$','mainapp.views.eventdetail'),
>     (r'^partners/$','mainapp.views.partners'),
>     (r'^admin/', include(admin.site.urls)),
> )
> urlpatterns += staticfiles_urlpatterns()
>
> Once again, I'm using the following to link to my CSS file:
>
> <link rel="stylesheet" type="text/css" href='{{ STATIC_URL
}}stylesheet.css' />
>
> Am I still missing something?  Did I enter in anything incorrectly?
>
> thanks,
> Guillaume
>
> On Tue, Aug 2, 2011 at 6:06 PM, Thomas Orozco <g.orozco.tho...@gmail.com>
wrote:
>
> Last thing, I made a typo, the address you could use should start with
http, like: http://127.0.0.1/static/
>
> Le 2 août 2011 12:01, "Thomas Orozco" <g.orozco.tho...@gmail.com> a
écrit :
>> A little detail, but you never know: you should put some ' ' in your
link.
>> Like this :
>>
>> <link rel="stylesheet" type="text/css" href='{{ STATIC_
>> URL }}stylesheet.css' />
>>
>>
>> If there are spaces in your path, this could cause the lookup to fail.
>>
>> And even if that's not the case, don't rely on the user's browser to fix
>> coding mistakes.
>> Le 2 août 2011 10:28, "Guillaume Chorn" <guillaumech...@gmail.com> a
écrit :
>>> 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?
>>>
>>

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