2 Star 16 Fork 10

apanly/python3_flask_frame

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README
BSD-3-Clause

高可用高性能定制化 Python Flask MVC

缘由

Python在AI,AR VR这块使用越来越广泛。同时在Web方面也有很多成熟的框架。而我本身由于使用
Flask 比较多,个人认为就是比较简单,容易入手,可定制化强。这里我将我经过多个项目多次迭代的
自认为还可以的框架结构整理出来。方便自己可以更容易创建新项目。如果大家喜欢可以也拿去用用

QuickStart

  • Python3
  • pip install -r requirements.txt

启动

  • 启动web服务
    • export ops_config="local|production" && python manage_web.py runserver
  • 启动api服务
    • export ops_config="local|production" && python manage_api.py runserver
  • 启动Job
    • export ops_config="local|production" && python manage_job.py runjob -m test
  • 查看Job列表
    • export ops_config="local|production" && python manage_job.py joblist

预览截图

Web

  • 登录
  • 仪表盘

Api

  • Api

Job

  • Job

代码目录结构

.
├── application.py  封装的Flask的全局变量,包括app,数据库等
├── common 存放公用部分
│   ├── libs  公用方法或者类
│   ├── models 所有的数据库model
├── config 配置文件
│   ├── base_setting.py   基础配置
│   ├── develop_setting.py 开发环境
│   ├── local_setting_demo.py 本地开发环境配置demo
│   └── production_setting.py 生产环境的配置
├── docs 文档存放
│   ├── Mysql.MD  所有数据库变更必须在这里记录
├── jobs 定时任务
│   ├── bin
│   └── tasks 所有定时任务都存放在这里
├── router 路由配置入口
│   ├── www.py 对应web的路由配置
│   └── api.py 对应api的路由配置
├── manage_web.py web启动入口
├── manage_job.py job定时器启动入口
├── manage_api.py api启动入口 (如果有api的话)
├── requirements.txt python 扩展
├── uwsgi.ini 生产环境uwsgi
├── web  HTTP存放
│   ├── controllers 所有的C层放在这里
│   ├── interceptors 拦截器相关
│   ├── static 静态文件
│   └── templates 模板文件

Flask参考文档

问题处理

  • 安装 MySQL-python ,结果出错 ImportError: No module named 'ConfigParser'
在 Python 3.x 版本后,ConfigParser.py 已经更名为 configparser.py 所以出错!
解决方法:pip install mysqlclient
BSD 3-Clause License Copyright (c) 2020, apanly All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

About

高可用高性能定制化 Python Flask MVC http://www.54php.cn expand collapse
Python
BSD-3-Clause
Cancel

Releases

No release

Contributors

All

Activities

Load More
can not load any more
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/apanly/python3_flask_frame.git
git@gitee.com:apanly/python3_flask_frame.git
apanly
python3_flask_frame
python3_flask_frame
master

Search

344bd9b3 5694891 D2dac590 5694891