Yes. Proper root referencing requires the preceeding / in /a/b

The django way i have seen is to generally create a /static/ directory
Put  /static in your static settings rather than /static/assets

place your files in respectively named  directories such as /static/js 
/static/css /static/images /static/html  etcetera

On Saturday, April 20, 2013 4:11:40 AM UTC-4, Sanjay Bhangar wrote:
>
> On Sat, Apr 20, 2013 at 10:43 AM, Paras Nath Chaudhary <
> opncha...@gmail.com <javascript:>> wrote:
>
>> How I do this is in settings.py:
>> PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
>> STATIC_ROOT = os.path.join(PROJECT_ROOT, '../static')
>> STATIC_URL = '/static/'
>> STATICFILES_DIRS = (
>>     # Put strings here, like "/home/html/static" or 
>> "C:/www/django/static".
>>     # Always use forward slashes, even on Windows.
>>     # Don't forget to use absolute paths, not relative paths.
>>     os.path.join(PROJECT_ROOT,'../static/assets'),
>> )
>>
>>
>> In template files. 
>>  <link href="static/css/bootstrap.min.css" rel="stylesheet" 
>> media="screen">
>>
>>
> Shouldn't that be:
>  <link href="/static/css/bootstrap.min.css" rel="stylesheet" 
> media="screen">
>
> ( /static/ ... instead of static/ ... )
>
> If its missing the initial slash, the link would be relative to the 
> current page, which would be fine at http://yourdomain.com or 
> http://yourdomain.com/foo but would break if you were linking from 
> http://yourdomain.com/foo/bar .. 
>
> -Sanjay
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to