Reputation: 16479
On FireBug I get these errors
GET http://localhost:8000/static/bootstrap/css/bootstrap.min.css 404 (NOT FOUND) localhost/:7
GET http://localhost:8000/static/bootstrap/js/bootstrap.min.js 404 (NOT FOUND) localhost/:8
GET http://localhost:8000/static/bootstrap/css/bootstrap.min.css 404 (NOT FOUND)
My STATIC_ROOT is :
STATIC_ROOT = '/home/bradford/Development/Django/public_pictures/static'
I placed my bootstrap files in a 'static' directory. This 'static' directory is located in my project named 'public_pictures'. I'm not sure why these files can't be located
Here is my HTML file:
<!DOCTYPE html>
{% load staticfiles %}
<head>
<link rel="stylesheet" href="{% static "bootstrap/css/bootstrap.min.css" %}" type="text/css" media="screen" />
<script type="text/javascript" src="{% static "bootstrap/js/bootstrap.min.js" %}" ></script>
</head>
<html>
<body>
<span class="badge badge-success" >HI!</span>
<span class="badge">1</span>
<span class="badge badge-warning">4</span>
<span class="badge badge-important">6</span>
<span class="badge badge-info">8</span>
<span class="badge badge-inverse">10</span>
</body>
</html>
As a result, only regular text is displayed for these bootstrap badges.
Any input is appreciated thank you!!
******EDIT*************
So as of right now my STATICFILES_DIRS in settings.py is
STATICFILES_DIR = ('/home/bradford/Development/Django/public_pictures/static',)
STATIC_ROOT = '', # blank
STATIC_URL = '/static/'
DEBUG = True
urls.py:
from django.conf.urls import include, url, patterns
urlpatterns = patterns('',
url(r'homepage/',include('homepage.urls', namespace = "homepage")),
)
index.html (template)
<!DOCTYPE html>
{% load staticfiles %}
<head>
<link rel="stylesheet" href="{% static "bootstrap/css/bootstrap.min.css" %}" type="text/css" media="screen" />
<script type="text/javascript" src="{% static "bootstrap/js/bootstrap.min.js" %}" ></script>
</head>
<html>
<body>
<span class="badge badge-success" >HI!</span>
<span class="badge">1</span>
<span class="badge badge-warning">4</span>
<span class="badge badge-important">6</span>
<span class="badge badge-info">8</span>
<span class="badge badge-inverse">10</span>
</body>
</html>
All these changes lead me a bit closer to my goal. However the badges of the bootstrap is displayed but there is no color being displayed. Everything is grey with white text =[ I'm not sure if the other features work as well. I shall try them. Thank you again for all the help! much appreciated!
Upvotes: 1
Views: 4272
Reputation: 2836
Development Server:
Leave STATIC_ROOT
empty.
Make a change to STATICFILES_DIRS
STATICFILES_DIRS = (
'/home/bradford/Development/Django/public_pictures/static',
)
Run ./manage.py collectstatic
Should work.
Upvotes: 2
Reputation: 4391
It seems that you have forgot to include your static url in urls.py. If you are using development server you can use the following code in urls.py:
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = patterns('',
# ... the rest of your URLconf goes here ...
) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
More reference on deploying static files for development or for production.
Upvotes: 3