Coder Social home page Coder Social logo

flasktemplate's Introduction

Flask MVC开发模板

灵感源自SpringBoot,集成了Flask、Flask-SQLAlchemy、Flask-Cors、Redis、HttpX、PIL、PyYaml等框架。采用登录验证装饰器控制接口访问权限,会话管理采用Token + Redis方式,为什么不用JWT?因为我想踢掉其他客户端会话。另外集成了字符串、日期时间等工具包,方便快速开发。

简要说明

项目使用Python>=3.7,强烈推荐使用venv环境,避免环境冲突;整个项目应关注于application目录下的内容,其他目录为辅助工具。

一、配置项目

  1. 编辑config-template.yaml配置模板。
  2. 将配置信息复制到config.yaml(新建)中。

二、开发顺序(推荐)

  1. application/model目录,创建数据库模型,并在application/model/__init__.py导入。
  2. application/mapper目录,创建表操作。
  3. application/logic目录,创建业务逻辑。
  4. application/controller目录,创建控制器。
  5. 注册蓝图、异常均在application/__init__.py

三、运行项目

  1. Run:python main.py

注意: Windows下自动使用Flask默认的HTTP服务器,Linux下将自动使用gunicorn作为HTTP服务器。

四、扩展

  1. application/config自定义配置。
  2. application/enumeration自定义枚举类型。
  3. application/util自定义工具类。
  4. application/exception自定义异常类。
  5. application/middleware自定义中间件。

flasktemplate's People

Stargazers

h4xx0rz avatar

Watchers

h4xx0rz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.