Django Bootstrap Base Template

Adi Ramadhan
2 min readJul 15, 2020

Simple django bootstrap base template. Official reference for django template and bootstrap.

Step 1: Preparation, Create Django Project, Initial Migration
install virtualenv: pip install virtualenv
create virtualenv: virtualenv venv
start virtualenv: venv/Scripts/activate
install Django in virtualenv: pip install django==3.0
Create Django: django-admin startproject myproject
Go to myproject folder: cd myproject
Migrate: python migrate

Step 2. Create Django Apps
Create apps: python startapp myapp
Add myapp to INSTALLED_APPS in myproject/

Step 3. Preparing Templates Folder
Add folder templates in myapp

Register myapp/templates in myproject/

os.path.join(BASE_DIR, 'myapp', 'template')

Step 4. Add html file in myapp/templates folder
Add bootstrap base, create base.html CDN Bootstrap.


Create home.html in myapp/templates which implement base.html. Following codes is jumbotron example from official Bootstrap doc.


Step 5. Set up views and urls
Add render method in myapp/


Create file in myapp folder


Add myapp/ to myproject/ using include


Step 6. Run and Try it in browser
python runserver