Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using bootstrap and django

I am trying to get bootstrap working in my django project and followed the tutorial here but it did not work. When I visit the my local project in the browser it just shows a blank page with 4 blue links. not exaclty what I was expecting. In pycharm (my ide) it tells me that I have an unresolved refrence to STATIC_URL in my template. I think the problem is that by just placing bootstrap in my project and defining it in my settings wasnt enough. any ideas?

Sorry, basically here is how my project is set up. Main_Project/ app_1, app_2 , media/, templates/, Main_Project/ so should I put boostrap under the first Main_Project, or the second

Also here is my settings in case it matters.

STATIC_ROOT = os.path.join(SITE_ROOT, 'static_files')

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
like image 753
user2251164 Avatar asked May 04 '13 17:05

user2251164


Video Answer


1 Answers

Kevin here, the author of that article from Python Diary. Since I posted that tutorial I have created other methods of enabling Bootstrap in a Django project, including a handy Project template, which can be downloaded from here:

http://www.pythondiary.com/templates/bootstrap

I have also started a Project on BitBucket since which has a Django bootstrap theme app which is super easy to use, just add it to your "INSTALLED_APPS" and then extend whichever template from the original Bootstrap website, such as starter.html among others to choose from. Of course you can also spin your own bootstrap theme as well. I try to actively update it and am looking for more suggestions to make it the "Django goto app" for developers looking to use Bootstrap in their project, the BitBucket repo can be found here:

https://bitbucket.org/kveroneau/django-bootstrap-theme

Hope this helps anyone else who may stumble upon this Stackoverflow page.

like image 163
kveroneau Avatar answered Nov 15 '22 19:11

kveroneau