Skip to content

Latest commit

 

History

History
65 lines (40 loc) · 2.86 KB

README.md

File metadata and controls

65 lines (40 loc) · 2.86 KB

[中文文档Chinese Doc]

Schurz

A Web Framework build from Flask. Its source file structure is inspired by Django (With such reason, named Schurz, another role in movie Django Unchained).

Django is perfect, but too huge to mold it. Flask is lightweight, but it is too flexible to build an tidy project —— everyone has his own preference, it is hard to read other's project.

Schurz build with Flask, but use Flask's toolchain. Maybe classify Schurz as Demo/Example is better.

Feature map

Feature Django Schurz
shell project manager mange.py Click、Alembic
HTML DebugTool Django-DebugToolBar Flask-DebugToolBar
Admin from django.contrib import admin Flask-Admin
HTML Form from django import forms Flask-WTF
User authenticate(); login();logout Flask-Login、Flask-Login、Flask-Security
Signal from django.db.models.signals import post_save Blinker、Flask-Login
AOP from django.utils.deprecation import MiddlewareMixin Flask hook function、Werkzeug Middleware

Project Stucture

.
├── apis            # restful app
├── apps            # app use templates
├── schurz          # project core
│   ├── settings.py # settings/configurations
│   ├── urls.py     # main of urls
│   └── wsgi.py     # define app. run app with this module
├── static          # static files
├── templates       # html tempaltes
├── tests           # unittests
├── utils           # tools for project
├── manage.py       # just like Django, `python manage.py [CMD]`
├── docs            # documents
├── migrations      # just like Django, migration files for model change
├── gunicorn.conf   # gunicorn configurations
└── requirements.txt

Introduction

There are 2 patterns in view:

  • MVT: use templates.
  • Restful api : do not use tempaltes, make restful json response.

Then, I will show two different database choices in below : SQLite as a SQL, MongoDB as a NoSQL. If you want use Postgre, MySQL, Oracle, SQLserver, check SQLAlchemy documents, and you can handle it.

SQLite + MVT