Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here

Flask-Scaffold

Prototype Database driven CRUD Admin dashboards and RESTFUL API's with Python, Flask, SQLALchemy, Javascript/Angularjs and Bootstrap 3

Subscribe to updates I use Flask-Scaffold


Statistics on Flask-Scaffold

Number of watchers on Github 688
Number of open issues 8
Average time to close an issue 3 months
Main language Python
Average time to merge a PR about 21 hours
Open pull requests 0+
Closed pull requests 2+
Last commit over 1 year ago
Repo Created over 4 years ago
Repo Last Updated over 1 year ago
Size 21.7 MB
Homepage https://techarena...
Organization / Authorleo-g
Latest Release0.7
Contributors3
Page Updated
Do you use Flask-Scaffold? Leave a review!
View open issues (8)
View Flask-Scaffold activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating Flask-Scaffold for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

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
  • RESTFUL JSON API
  • 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

Installation

Please ensure that development libraries for PostgreSQL are installed.

Step 1:Clone the project to your application folder.

git clone git@github.com:Leo-g/Flask-Scaffold.git YourAppFolderName && cd YourAppFolderName

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

pip install -r requirements.txt

vim config.py
#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 https://github.com/Leo-g/Flask-Scaffold/wiki/Fields

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

Step 4 : Run the Scaffolding and database migrations script

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

Step 5 : Run the Server

python run.py

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

Tests

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

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 jsonapi.org and a sample is available in the sample.json file

Tutorials

https://techarena51.com/blog/buidling-a-database-driven-restful-json-api-in-python-3-with-flask-flask-restful-and-sqlalchemy/?utm_source=gh-flask-scaffold-readme

https://techarena51.com/blog/tag/flask-tutorials/?utm_source=gh-flask-scaffold-readme

Directory Structure

    Project-Folder
        |-- config.py
        |--run.py
        |--requirements.txt
        |--conf.js
        |__ /venv
        |-- db.py
        |__ /scaffold
        |-- scaffold.py
        |-- tests.bash    #Tests for all modules
        |__ app/
            |-- __init__.py
            +-- module-1
                |-- __init__.py
                |-- models.py
                |-- test_module-1.py  # Unit Tests for module 1
                |-- views.py

            +-- module-2
                |-- __init__.py
                |-- models.py
                |-- test_module-2.py  # Unit Tests for module 2
                |-- views.py
            |__ 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
              AnalyticsProvider.setAccount('UA-XXXXX-xx');
              AnalyticsProvider.setDomainName('XXX');

   });

Angularjs

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

For complete Documentation see the wiki

Flask-Scaffold open issues Ask a question     (View All Issues)
  • almost 3 years Remove/ Add single or multiple fields
  • over 3 years No such file or directory: 'autopep8'
  • over 3 years UnicodeEncodeError: 'ascii' codec can't encode character '\u2019'
  • over 3 years Websocket support ?
  • over 3 years Add Travis Ci tests for OS X
  • about 4 years Add SQLAlchemy Relationships
  • about 4 years Add setup File
  • about 4 years Create a manage.py script to run server and migrations
Flask-Scaffold list of languages used
Flask-Scaffold latest release notes

Bootstrap 3 Support

  • Fixed MySQL table creation bug
  • Added Tutorials to Readme
  • Fixed encoding with the Open function
Other projects in Python