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

Overview

Flask-Bootstrap

Flask-Bootstrap is an Flask app template for users to clone and customize as desired, as opposed to a Flask extension that you can install and use in your existing application.


This version of Flask-Bootstrap app template, v0.2.0, is a distinctly different version of the prior flask application template, now better organized using Flask blueprints. I think users will find this version much better suited for anything larger than the very smallest of server-side web apps.

Nonetheless, in the event that you'd like to use the old flask-bootstrap template, that version can now be found in the old_master branch.


Features

  • Flask, including Flask-SQLAlchemy for user data and Flask-Login for authentication
  • Bootstrap 3
  • Webassets for easy Javascript deployment
  • Targeting OWASP web security standards
  • Python 2 and 3 support

Version

0.2.1

Build Status

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 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

Changelog

v0.2.1

  • Added filler template pages, including user settings page
  • Reorganized module naming (mod_home->mod_unauthenticated)
  • Restyled Bootstrap in homepage and navbar

v0.2.0

  • Flask Blueprints
  • Flask-assets asset for Javascript and other static assets, based on the webassets module
  • CSRF protection

Roadmap

  • For v0.3.0
    • More unit tests for Flask app and JavaScript
    • Automated app naming through Flask-Script or Makefile
    • Add more and better documentation, using Sphinx
    • More attractive user interface
  • By version 1.0.0
    • Comprehensive security review and tests using OWASP standards
    • Full Windows and OSX support

License

BSD

Comments
  • No module named 'user'

    No module named 'user'

    When I try to run createdb, I get the following error:

    (venv)/Users/joe/projects/flask-bootstrap (development) $ python manage.py createdb
    Traceback (most recent call last):
      File "manage.py", line 5, in <module>
        from app.database import db
      File "/Users/joe/projects/flask-bootstrap/app/__init__.py", line 7, in <module>
        from app.login import login_manager, login_view, logout_view, user_create
      File "/Users/joe/projects/flask-bootstrap/app/login.py", line 5, in <module>
        from app.models.user import User, ROLE_USER, ROLE_ADMIN
      File "/Users/joe/projects/flask-bootstrap/app/models/__init__.py", line 1, in <module>
        from user import User
    ImportError: No module named 'user'
    

    I followed the instructions step by step and I can't seem to get past this point.

    opened by sabernar 5
  • License change to match Flask's BSD license

    License change to match Flask's BSD license

    Are there any objections if I change the license from Apache to 3-clause BSD? I actually prefer the MIT or Apache, but on retrospect I'd like for the project license to match Flask's license so that folks don't have to deal with more licenses that necessary for a single project.

    In the words of the Flask license information page, the 3-clause BSD license basically means: "do whatever you want with it as long as the copyright in Flask sticks around, the conditions are not modified and the disclaimer is present. Furthermore you must not use the names of the authors to promote derivatives of the software without written consent".

    So you're free to use this skeleton for closed-source proprietary projects under both Apache and BSD, as long as you keep the copyright.

    Note that the 3-clause BSD is FSF-compatible, as well as OSD-compliant.

    Any existing code that's already been used for a project would of course remain Apache-licensed. The BSD license would only apply to new projects.

    opened by esbullington 5
  • I run your program in pycharm ,but appearing any problem

    I run your program in pycharm ,but appearing any problem

    I input python run.py in pychram ,it Prompt error like this (venv) C:\Users\Ming\Downloads\flask-bootstrap-master>python run.py C:\Users\Ming\Downloads\flask-bootstrap-master\app\__init__.py:3: ExtDeprecationWarning: Importing flask.ext.sqlalchemy is deprecated, use flask_sqlalchemy instead. from flask.ext.sqlalchemy import SQLAlchemy C:\Users\Ming\Downloads\flask-bootstrap-master\app\__init__.py:4: ExtDeprecationWarning: Importing flask.ext.login is deprecated, use flask_login instead. from flask.ext.login import LoginManager, current_user C:\Users\Ming\Downloads\flask-bootstrap-master\app\__init__.py:5: ExtDeprecationWarning: Importing flask.ext.assets is deprecated, use flask_assets instead. from flask.ext.assets import Environment, Bundle C:\Users\Ming\Downloads\flask-bootstrap-master\app\database.py:3: ExtDeprecationWarning: Importing flask.ext.bcrypt is deprecated, use flask_bcrypt instead. from flask.ext.bcrypt import Bcrypt C:\Users\Ming\Downloads\flask-bootstrap-master\app\mod_users\controllers.py:15: FlaskWTFDeprecationWarning: "flask_wtf.CsrfProtect" has been renamed to "CSRFProtect" and will be removed in 1.0. csrf = CsrfProtect() Traceback (most recent call last): File "run.py", line 5, in <module> app = create_app() File "C:\Users\Ming\Downloads\flask-bootstrap-master\app\__init__.py", line 21, in create_app config = os.path.join(app.root_path, os.environ.get('FLASK_APPLICATION_SETTINGS')) File "C:\Users\Ming\Downloads\flask-bootstrap-master\venv\lib\ntpath.py", line 67, in join p_drive, p_path = splitdrive(p) File "C:\Users\Ming\Downloads\flask-bootstrap-master\venv\lib\ntpath.py", line 115, in splitdrive if len(p) > 1: TypeError: object of type 'NoneType' has no len() In my limited in Python I can fix it , please help or try to give some ideas how to achieve this

    opened by MMingLeung 1
  • completed bootstrap migration on overlooked templates

    completed bootstrap migration on overlooked templates

    The Bootstrap 3 migration was done on some pages but not fully, and just completely forgotten on the others, I have been able to look over all the templates and make sure they are fully working with the new Bootstrap.

    opened by lizardlab 1
  • Fix broken headings in Markdown files

    Fix broken headings in Markdown files

    GitHub changed the way Markdown headings are parsed, so this change fixes it.

    See bryant1410/readmesfix for more information.

    Tackles bryant1410/readmesfix#1

    opened by bryant1410 0
  • Installation error

    Installation error

    On Ubuntu 14.04 LXDE, getting this error when running pip install -r config/requirements.txt: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-EwQkuR/psycopg2.

    What could be the issue?

    opened by cbll 0
Owner
Eric S. Bullington
Eric S. Bullington
Flask Project Template A full feature Flask project template.

Flask Project Template A full feature Flask project template. See also Python-Project-Template for a lean, low dependency Python app. HOW TO USE THIS

Bruno Rocha 96 Dec 23, 2022
Flask-template - A simple template for make an flask api

flask-template By GaGoU :3 a simple template for make an flask api notes: you ca

GaGoU 2 Feb 17, 2022
Burp-UI is a web-ui for burp backup written in python with Flask and jQuery/Bootstrap

Burp-UI Contents Introduction Screenshots Demo What's that? Who are you? Documentation FAQ Community Notes See also Licenses Thanks Introduction Scree

Benjamin 84 Dec 20, 2022
Flask-Starter is a boilerplate starter template designed to help you quickstart your Flask web application development.

Flask-Starter Flask-Starter is a boilerplate starter template designed to help you quickstart your Flask web application development. It has all the r

Kundan Singh 259 Dec 26, 2022
flask-apispec MIT flask-apispec (🥉24 · ⭐ 520) - Build and document REST APIs with Flask and apispec. MIT

flask-apispec flask-apispec is a lightweight tool for building REST APIs in Flask. flask-apispec uses webargs for request parsing, marshmallow for res

Joshua Carp 617 Dec 30, 2022
Mixer -- Is a fixtures replacement. Supported Django, Flask, SqlAlchemy and custom python objects.

The Mixer is a helper to generate instances of Django or SQLAlchemy models. It's useful for testing and fixture replacement. Fast and convenient test-

Kirill Klenov 870 Jan 8, 2023
Mixer -- Is a fixtures replacement. Supported Django, Flask, SqlAlchemy and custom python objects.

The Mixer is a helper to generate instances of Django or SQLAlchemy models. It's useful for testing and fixture replacement. Fast and convenient test-

Kirill Klenov 742 Feb 9, 2021
REST API with Flask and SQLAlchemy. I would rather not use it anymore.

Flask REST API Python 3.9.7 The Flask experience, without data persistence :D First, to install all dependencies: python -m pip install -r requirement

Luis Quiñones Requelme 1 Dec 15, 2021
Forum written for learning purposes in flask and sqlalchemy

Flask-forum forum written for learning purposes using SQLalchemy and flask How to install install requirements pip install sqlalchemy flask clone repo

Kamil 0 May 23, 2022
SQLAlchemy database migrations for Flask applications using Alembic

Flask-Migrate Flask-Migrate is an extension that handles SQLAlchemy database migrations for Flask applications using Alembic. The database operations

Miguel Grinberg 2.2k Dec 28, 2022
Adds SQLAlchemy support to Flask

Flask-SQLAlchemy Flask-SQLAlchemy is an extension for Flask that adds support for SQLAlchemy to your application. It aims to simplify using SQLAlchemy

The Pallets Projects 3.9k Dec 29, 2022
SqlAlchemy Flask-Restful Swagger Json:API OpenAPI

SAFRS: Python OpenAPI & JSON:API Framework Overview Installation JSON:API Interface Resource Objects Relationships Methods Custom Methods Class Method

Thomas Pollet 365 Jan 6, 2023
Brandnew-flask is a CLI tool used to generate a powerful and mordern flask-app that supports the production environment.

Brandnew-flask is still in the initial stage and needs to be updated and improved continuously. Everyone is welcome to maintain and improve this CLI.

brandonye 4 Jul 17, 2022
Flask-app scaffold, generate flask restful backend

Flask-app scaffold, generate flask restful backend

jacksmile 1 Nov 24, 2021
Flask starter template for better structuring.

Flask Starter app Flask starter template for better structuring. use the starter plate step 1 : cloning this repo through git clone the repo git clone

Tirtharaj Sinha 1 Jul 26, 2022
A template themes for phyton flask website

Flask Phyton Web template A template themes for phyton flask website

Mesin Kasir 2 Nov 29, 2021
A template for Flask APIs.

FlaskAPITempate A template for a Flask API. Why tho? I just wanted an easy way to create a Flask API. How to setup First, use the template. You can do

TechStudent10 1 Dec 28, 2021
Boilerplate template formwork for a Python Flask application with Mysql,Build dynamic websites rapidly.

Overview English | 简体中文 How to Build dynamic web rapidly? We choose Formwork-Flask. Formwork is a highly packaged Flask Demo. It's intergrates various

aswallz 81 May 16, 2022