[Solved]-Where do I install Twitter Bootstrap for Django – main or static folder?

14👍

Django-bootstrap is a Django “app”, installed as a python package. Since webfaction doesn’t do virtualenv, you should be ok* to just ssh in and run

pip install -e git+git://github.com/earle/django-bootstrap.git#egg=bootstrap

from wherever. This will install django-bootstrap to your global python site-packages folder.

Next, you’ll need to make sure django knows about it, which you do by editing the settings file and adding it to INSTALLED_APPS, e.g.

INSTALLED_APPS = (
# ... other things
'bootstrap',
# ... maybe more things
)

Any python file that uses the BootstrapForm and Fieldset classes, will require the import statement at the top of it. A python module (file) will only know about a) what you declare directly in it, and b) what you explicitly import. I don’t know how you got anywhere using python without knowing that, because it’s pretty important. Consider reading up on the subject.*

Anyhow, the only thing django-bootstrap seems to do is change django’s form-rendering code to output HTML that is more compatible with Bootstrap. You will still need get twitter-bootstrap yourself, and make sure that you use the media, i.e. the css, js and images, from it. Put the bootstrap media in your static app.

http://twitter.github.com/bootstrap/

*Edit: I just read the last bit of your post and now I feel like a big meanie. So, here are some extra resources that I recommend you read through.

Python samples: http://wiki.python.org/moin/SimplePrograms

Django’s Tutorial: https://docs.djangoproject.com/en/1.3/intro/tutorial01/

2👍

I’m afraid I don’t quite understand the question. pip install will install this in de site-packages folder, not in the location you are running the command from.

The code is a form so would go into a forms.py within the app you are trying to make. That form inherits from BootstraForm, so you would just use the LoginForm where you want and it would be a BootstrapForm.

👤nopogo

Leave a comment