Skip to content

A Flask app template with integrated SQLAlchemy, authentication, and Bootstrap frontend

License

Notifications You must be signed in to change notification settings

rainsome-org1/flask-bootstrap

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flask-bootstrap

Build Status

Flask application framework pre-configured for SQL Alchemy, flask-login, and Twitter bootstrap frontend. Meant to serve as a skeleton application for you to customize as desired, not as a Flask extension.

If you are looking for a Flask extension that uses Flask blueprints to provide Bootstrap support, try the other flask-bootstrap.

Quickstart

  • Install the system dependencies and Python dependencies
  • Customize your config/app.cfg (make create_cfg creates a basic config/local.cfg)
  • Fill out appropriate Makefile variables and run make
  • Then: python run.py or make run

Full installation instructions

The main system dependencies are Python, Postgreql, and their respective development packages. It could be easily adapted to run on MySQL or even SQLite, but the default installation instructions and Makefile below assume the use of PostgreSQL.

Makefile

If you're on Ubuntu or Mint and you using Make, you're in luck. There is a very convenient Makefile to install and run the application (should work with Debian with a few minor changes). If you wish to use the Makefile, then simply fill in the appropriate config variables in the Makefile, run make install to install dependencies, and make run to start the application. The Makefile installation will even create a default local.cfg containing your project's configuration, for you to use and customize.

Otherwise, refer to the instructions below.

1. System dependencies:

On Ubuntu or Debian, first install:

sudo apt-get install postgresql python-dev libpq-dev

Red Hat, Fedora, and other derivatives are said to require (confirmation would be welcome):

yum install yum install postgresql-devel postgresql-libs libpqxx-devel

Here's a brief article on getting these dependencies running on Windows (exact instructions would be welcome).

2. Python virtual environment and dependencies

It's probably a good idea to create a virtual environment for this project using virtualenv and virtualenvwrapper, which are installed using:

pip install virtualenvwrapper

Then, clone the repo, cd into it, and create a project virtual environment. I like to host my virtual environments in each project directory (but include it in the .gitignore so it's not gitable). So something like:

git clone git://github.com/esbullington/flask-bootstrap.git
cd flask-bootstrap
virtualenv venv
source venv/bin/activate

Once you have the virtual environment installed on your system, and the system dependencies, the rest is simple:

pip install -r config/requirements.txt

Configuration

  • If you're using the Makefile, be sure to set your config filename
  • Otherwise, you can either:
    • pass your config file using python manage.py -c config/yourconfig.cfg runserver or else
    • set an environmental variable FLASK_APPLICATION_SETTINGS to point to your config file
  • Check to be sure your SECRET_KEY config setting is indeed secret and cryptographically strong (120+ bits of entropy)
  • The Makefile command make create_cfg sets this SECRET_KEY automatically as part of the config creation

Tests

make test or python manage.py testall

Master:

Build Status

Dev:

Build Status

Features

  • Base requirements.txt.
  • Bootstrap 3.1 frontend framework from Twitter.
  • Pre-integrated with flask-login, just create your postgres db and fill in models and app.cfg accordingly.
  • Existing user model and basic login/signup.

Roadmap

  • For v0.0.2 release (imminent)
    • More unit tests for Flask app and JavaScript
    • Coherent organization of CSS assets
    • Flask-WTF support
  • For v0.0.3
    • Integrate some sort of Python asset manager for static assets (i.e., JS/CSS minifier, file concatenator)
    • Automated app naming through Flask-Script or Makefile
    • Add more and better documentation, using Sphinx and mitsuhiko/flask-sphinx-themes
    • Comprehensive security review and tests using OWASP standards

About

A Flask app template with integrated SQLAlchemy, authentication, and Bootstrap frontend

Resources

License

Stars

Watchers

Forks

Packages

No packages published