codeKrowe / tifa

a modern flask scaffolding

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tifa

Build Status PyPI license license

A modern flask scaffolding

Introduction

Flask and Webpack are both brilliant tool for developers to quickly setup and develop web applications. The combination of them two could meet most modern web development requirements today.

If you want to build a traditional web server:

Web server ( Flask ) + Webpack ( pack assets )

If you want to separate front-end and back-end:

API Server ( Flask ) + Front-end ( A SPA framework with webpack to pack assets )

Or more cutting-edge solution which I prefer recently, use traditional web server and Vue.js to improve user interaction by injecting web components:

Web server ( Flask ) + Front-end improvements ( Vue.js ) + Webpack ( pack assets )

tifa is a scaffolding designed to create these environments for you.

Install

$ pip install tifa

Usage

Generate a tifa configuration file

$ tifa init

Initialize project through configuration

$ tifa gen

This command would read ./tifa.yaml by default. To use a specific config file:

$ tifa gen --config path/to/config.yaml

Configuration Specs

name: <project name>
# for route `front`, empty url prefix would be given.
# other routes would have its name as route prefix.
routes:
  - front
  - api
# Use camel case for model name, tablename would automatically be transformed to underscore.
models:
  - User
  - Product
# if specified, would generate associated config files in `./conf` folder
confs:
  - supervisor
  - gunicorn
  - nginx
# webpack modes
# false: Web server ( Flask ) without webpack
# classic: Web server ( Flask ) + Webpack ( pack assets )
# separate: API Server ( Flask ) + Front-end ( Vue.js with webpack to pack assets )
# radical: Web server ( Flask ) + Front-end improvements ( Vue.js ) + Webpack ( pack assets )
webpack: classic

About

a modern flask scaffolding

License:MIT License


Languages

Language:Python 99.5%Language:Makefile 0.5%