python - style.css file location in django -


i have style.css file common across apps in django project. located follows:

testsite______               |               |            testsite               |               |              news                |               |             reviews               |               |            templates------>static------>css------> style.css               |               |            manage.py 

in settings.py of project, have staticfiles_dirs follows:

static_url = '/static/' staticfiles_dirs = (         "/path/to/my/project/templates/static/", ) 

i call css files in header of template follows:

<html>     <head>         <title>test site</title>         <link rel="stylesheet" type="text/css" href="{{ static_url }}css/style.css"/>     </head> 

however, css doesn't load. gives 404 error wherein server looks css file inside app (news, reviews). error follows:

"get /test-site/css/style.css http/1.1" 404 4147 

do need specify css in urls.py? missing out here?

no, dont have specify of css in urls. try put html

{% load staticfiles %} 

and call

<link rel="stylesheet" href="{% static 'css/style.css' %}" /> 

i , works fine.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -