python - Bootstrap static files not being included in Django template -
i'm new django, , facing issues rendering bootstrap on django page.
this base html,
{% load staticfiles %} <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- above 3 meta tags *must* come first in head; other head content must come *after* these tags --> <title>dropbox web app prototype</title> <!-- bootstrap --> <link href="{% static 'bootstrap/css/bootstrap.min.css' %}" rel="stylesheet"> <!-- html5 shim , respond.js ie8 support of html5 elements , media queries --> <!-- warning: respond.js doesn't work if view page via file:// --> <!--[if lt ie 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="jumbotron"> <h1>hello, world!</h1> <p>this template showcasing optional theme stylesheet included in bootstrap. use starting point create more unique building on or modifying it.</p> </div> <!-- jquery (necessary bootstrap's javascript plugins) --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <!-- include compiled plugins (below), or include individual files needed --> <script src="{% static 'bootstrap/js/bootstrap.min.js' %}"></script> </body> </html> the static file @ same level project directory , has following structure, 
i've added following line, settings.py file
staticfiles_dirs = (os.path.join(base_dir, "static"),) the css not rendering on home page. appreciated.
base_dir defined default to:
base_dir = os.path.dirname(os.path.dirname(__file__)) here __file__ settings.py, base_dir on parent directory, 1 contains manage.py.
it seems static folder on level, move same level manage.py , should work.
Comments
Post a Comment