Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
192 lines (142 sloc) 6.53 KB

Flask-Scaffold let's you Prototype Database Driven Admin Dashboards with Bootstrap 3, Python and a MySQL/Mariadb or PostgreSQL Database. It will also scaffold a RESTFUL API which can be used with any REST Frontend Framework.

Features include

  • Python 3 Support
  • Unit Testing with python Unit tests
  • End 2 End testing with Protractor
  • Continous Integration with Travis-CI
  • Inbuilt User Management and Admin Dashboard
  • Google Analytics
  • Bootstrap 3 Support
  • Datatables support

###Demo Sign Up and Login

Gitter PayPal donate button


Please ensure that development libraries for PostgreSQL are installed.

####Step 1:Clone the project to your application folder.

git clone YourAppFolderName && cd YourAppFolderName

####Step 2: Install the requirements and add your Database configuration details.

pip install -r requirements.txt

#Fill in your database username, password, name, host etc

Step 3 : Declare your Resource and it's fields in a YAML file as follows

For a list of supported fields please see

vim scaffold/blog.yaml
 - title:string
 - body:text
 - author:string
 - creation_date:date
 - published:boolean
 - author:string
 - body:text
 - author_url:url
 - created_on:date
 - approved:boolean
 - name:string
 - profile:text
 - url:url

Step 4 : Run the Scaffolding and database migrations script

python scaffold/blog.yaml
python db init
python db migrate
python db upgrade

Step 5 : Run the Server


**You should be able to see the Login Page at http://localhost:5000, Sign Up and Login

###Examples Freddy a Blogging Engine

Running Asynchronous commands on Linux with Flask and Celery


####For E2E testing with protractor Installation instructions for protractor are in the wiki

# To run tests for all modules
protractor conf.js

# To run a a test for a specific module

protractor app/templates/<module_name>/conf.js

####For unit testing with python Unit tests

For a Single module

python app/<module_name>/test_<module_name>.py

For all modules

bash tests.bash


API calls can be made to the following URL

Note: This example is for a Post module

HTTP Method URL Results
GET http://localhost:5000/api/v1/posts.json Returns a list of all Posts
POST http://localhost:5000/api/v1/posts.json Creates a New Post
GET http://localhost:5000/api/v1/posts/1.json Returns details for the a single Post
PATCH http://localhost:5000/api/v1/posts/1.json Update a Post
DELETE http://localhost:8001/api/v1/posts/1.json Delete a Post

The JSON format follows the spec at and a sample is available in the sample.json file


###Directory Structure Project-Folder |-- | |--requirements.txt |--conf.js |__ /venv |-- |__ /scaffold |-- |-- tests.bash #Tests for all modules |__ app/ |-- +-- module-1 |-- |-- |-- # Unit Tests for module 1 |--    +-- module-2 |-- |-- |-- # Unit Tests for module 2 |-- |__ templates |-- index.html |-- login.html |-- home.html +-- static + -- js |-- app.js |-- login.js |-- css |-- images +-- module-1    |-- _form.html    |-- index.html    |-- add.html    |-- update.html |-- controller.js |--conf.js |--spec.js    +-- module-2    |-- _form.html    |-- index.html    |-- add.html    |-- update.html |-- controller.js |-- conf.js |-- spec.js

Google Analytics

Add your tracking ID and Domain name in app.js in the app.config section

  app.config(function (AnalyticsProvider) {
              // Set a single account



The frontend currently uses Angularjs 1.5 and ui-router for routes.

For complete Documentation see the wiki