Bootstrap Django and jQueryUI

A common project I personally use myself, as I enjoy lots of the advanced widgets in jQueryUI, but still love using the layout manager of Bootstrap.

This template provides a main bootstrap look and feel, but allows you to use jQueryUI widgets and components if you need them. Let's face it, Bootstrap just doesn't have a large plugin library, which jQueryUI has.


import os.path
PROJECT_ROOT = os.path.normpath(os.path.dirname(__file__)+'/..') # The '/..' is required for Django 1.4+, remove for older versions.

DEBUG = True

    # ('Your Name', ''),


EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

    'default': {
        'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': '',                      # Or path to database file if using sqlite3.
        'USER': '',                      # Not used with sqlite3.
        'PASSWORD': '',                  # Not used with sqlite3.
        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.

# Local time zone for this installation. Choices can be found here:
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'America/Winnipeg'

# Language code for this installation. All choices can be found here:


# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True

# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/"
MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "", ""
MEDIA_URL = '/m/'

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/"
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')

# URL prefix for static files.
# Example: ""
STATIC_URL = '/s/'

# Additional locations of static files
    os.path.join(PROJECT_ROOT, 'bootstrap'),
    os.path.join(PROJECT_ROOT, 'jquery'),
    os.path.join(PROJECT_ROOT, 'assets'),

# List of finder classes that know how to find static files in
# various locations.
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',

# Make this unique, and don't share it with anybody.

# List of callables that know how to import templates from various sources.
#     'django.template.loaders.eggs.Loader',


    # Uncomment the next line for simple clickjacking protection:
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',

ROOT_URLCONF = 'project.urls'

# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'project.wsgi.application'

    os.path.join(PROJECT_ROOT, 'templates'),


# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See for
# more details on how to customize your logging configuration.
    'version': 1,
    'disable_existing_loggers': False,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse'
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'filters': ['require_debug_false'],
            'class': 'django.utils.log.AdminEmailHandler'
    'loggers': {
        'django.request': {
            'handlers': ['mail_admins'],
            'level': 'ERROR',
            'propagate': True,
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic.base import TemplateView

urlpatterns = patterns('',
    url(r'^$', TemplateView.as_view(template_name='base.html')),
    url(r'^admin/', include(,
{% load url from future %}
<!DOCTYPE html>
<html lang="en">
    <meta charset="utf-8">
    <title>Your Site</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- Le styles -->
    <link href="{{STATIC_URL|default:"/s/"}}css/cupertino/jquery-ui-1.9.1.custom.min.css" rel="stylesheet">
    <link href="{{STATIC_URL|default:"/s/"}}css/bootstrap.min.css" rel="stylesheet">
    <style type="text/css">
      body {
        padding-top: 60px;
        padding-bottom: 40px;
      {% block css %}{% endblock %}
    <link href="{{STATIC_URL|default:"/s/"}}css/bootstrap-responsive.min.css" rel="stylesheet">

    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src=""></script>

    <!-- Le fav and touch icons
    <link rel="shortcut icon" href="../assets/ico/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">
     <script src="{{STATIC_URL|default:"/s/"}}js/jquery-1.8.2.min.js"></script>
     <script type="text/javascript">
     {% block javascript %}
     {% block jquery %}
     {% endblock %}
     {% endblock %}
     {% if not debug %}{% include "analytics.html" %}{% endif %}

{% comment %}
    <div class="navbar navbar-inverse navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container">
          <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          <a class="brand" href="#">Project name</a>
          <div class="nav-collapse collapse">
            <ul class="nav">
              <li class="active"><a href="#">Home</a></li>
              <li><a href="#about">About</a></li>
              <li><a href="#contact">Contact</a></li>
              <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
                <ul class="dropdown-menu">
                  <li><a href="#">Action</a></li>
                  <li><a href="#">Another action</a></li>
                  <li><a href="#">Something else here</a></li>
                  <li class="divider"></li>
                  <li class="nav-header">Nav header</li>
                  <li><a href="#">Separated link</a></li>
                  <li><a href="#">One more separated link</a></li>
            <form class="navbar-form pull-right">
              <input class="span2" type="text" placeholder="Email">
              <input class="span2" type="password" placeholder="Password">
              <button type="submit" class="btn">Sign in</button>
          </div><!--/.nav-collapse -->
{% endcomment %}
    <div class="navbar navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container">
          <a href="/"><img src="{{STATIC_URL|default:"/s/"}}img/logo1.png" /></a>
          {% if user.is_authenticated %}
          <ul class="nav pull-right">
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-user"></i>{{user.first_name}} <b class="caret"></b></a>
              <ul class="dropdown-menu">
                <li><a href="{% url 'accounts:overview' %}"><i class="icon-briefcase"></i>My Account</a></li>
                <li><a href="{% url 'accounts:signout' %}"><i class="icon-off"></i>Sign out</a></li>
                {% if user.is_staff %}
                <li class="divider"></li>
                <li class="nav-header">Administration</li>
                <li><a href="{% url 'admin:index' %}">Site Administration</a></li>
                <li><a href="{% url 'admin:app_list' 'accounts' %}">Accounts</a></li>
                {% endif %}
          {% else %}
          <form class="navbar-form pull-right" action="{% url 'accounts:signin' %}" method="post">{% csrf_token %}
              <input class="span2" type="text" name="username" placeholder="Username">
              <input class="span2" type="password" name="password" placeholder="Password">
              <button type="submit" class="btn">Sign in</button>
          {% endif %}
    <div class="container">
      {% if messages %}
      <div class="row">
        <div class="span12">
          {% for message in messages %}
          <div class="alert alert-{{message.tags}}">
            <strong>{{message.tags|title}}:</strong> {{message}}
          {% endfor %}
      {% endif %}
      {% if debug %}
      <div class="alert"><strong>Running in DEBUG mode</strong></div>
      {% endif %}
{% block base_content %}
      <!-- Main hero unit for a primary marketing message or call to action -->
      <div class="hero-unit">
        <h1>Hello, world!</h1>
        <p>This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
        <p><a class="btn btn-primary btn-large">Learn more &raquo;</a></p>

      <!-- Example row of columns -->
      <div class="row">
        <div class="span4">
          <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
          <p><a class="btn" href="#">View details &raquo;</a></p>
        <div class="span4">
          <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
          <p><a class="btn" href="#">View details &raquo;</a></p>
        <div class="span4">
          <p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
          <p><a class="btn" href="#">View details &raquo;</a></p>
{% endblock %}

        <p>&copy; Your Site 2012</p>

    </div> <!-- /container -->
    <script src="{{STATIC_URL|default:"/s/"}}js/jquery-ui-1.9.1.custom.min.js"></script>
    <script src="{{STATIC_URL|default:"/s/"}}js/bootstrap.min.js"></script>
    {% block extrafooter %}{% endblock %}
Download as ZIP

* ZIP file is automatically generated and some elements such as the SECRET_KEY are regenerated as well.

About Me

My Photo
Names Kevin, hugely into UNIX technologies, not just Linux. I've dabbled with the demons, played with the Sun, and now with the Penguins.

Kevin Veroneau Consulting Services
Do you require the services of a Django contractor? Do you need both a website and hosting services? Perhaps I can help.

This Month

If you like what you read, please consider donating to help with hosting costs, and to fund future books to review.

Python Powered | © 2012-2019 Kevin Veroneau