当前位置:网站首页>Flask的创建的流程day05-06之创建项目
Flask的创建的流程day05-06之创建项目
2022-07-29 02:53:00 【糖果ᨐ不甜丫꧂】
1.创建文件夹
并通过搜索pycharm进行打开文件
2.创建虚拟环境
2.1 点击工具并且点击小扳手
2.2 点击箭头指的地方
2.3连续一直点击ok即可
最后提示这两个地方,显示有有新创的虚拟文件证明创建成了
#---------------------------------------------------------------------虚拟环境的创建
3.安装插件
3.1安装插件的命令
pip install -r 文件名
3.2创建app方法
3.3创建create_app对app方法进行封装
3.4app使用工厂方法和create_app进行封装
app
from create_app import create_app
from settings.config import DevConfig
app=create_app(DevConfig)
create_app
from flask import Flask
# 从模型类中获取db
from model.model import db
from view.user import user_db # 导入蓝图
from flask_cors import CORS # 配置跨域包
def create_app(config):
app=Flask(__name__)
# 加载配置的文件
app.config.from_object(config)
# 注册蓝图
app.register_blueprint(user_db)
# 初始化数据库
db.init_app(app)
# 配置跨域
CORS(app)
return app
边栏推荐
- Hangao database best practice configuration tool Hg_ BP log collection content
- Engineering boy: under 20 years old, ordinary but not mediocre
- Pgzero飞机大战
- 11. Writing rules - pseudo target
- 【机器人学习】机械臂抓手matlab运动学与admas动力学分析
- Implementation principle of golang synergy
- Flink kernel source code (VII) Flink SQL submission process
- 解析Steam教育中的项目式学习创造力
- 创客教育的起源和内涵的基本理念
- 【FreeSwitch开发实践】UniMRCP编译与安装
猜你喜欢
2.nodejs--路径(_dirname,_filname)、url网址、querystring模块、mime模块、各种路径(相对路径)、网页的加载(面试题*)
13_ue4进阶_蒙太奇动画实现一边走一边攻击
Weekly recommended short videos: how to make product development more effective?
centos安装mysql8
Multi table (Association) query of SQL query data
Engineering boy: under 20 years old, ordinary but not mediocre
Analysis of concepts and terms in data warehouse
The basic concept of the origin and connotation of maker Education
[opencv] use OpenCV to call mobile camera
Chapter 09_ Use of performance analysis tools
随机推荐
[NPM error] - NPM err code eresolve and NPM err eresolve could not resolve problems
centos安装mysql8
Summary of common hooks
The origin of Nacos' name
Interpreting AI robots' pet raising and leading fashion trends
融云实时社区解决方案
C语言基础知识点汇总
Trample --- discretization + tree array + difference
C和指针 第3章 语义“陷阱” 3.5 空指针并非字符串
C陷阱与缺陷 第3章 语义“陷阱” 3.4 避免“举偶法”
Tp5.0 applet users do not need to log in and directly obtain the user's mobile number.
解读AI机器人养宠引领时尚潮流
12. Writing rules - static mode
C陷阱与缺陷 第3章 语义“陷阱” 3.6 边界计算与不对称边界
会议OA项目之我的审批功能
04 | 后台登录:基于账号密码的登录方式(上)
瀚高数据库最佳实践配置工具HG_BP日志采集内容
数仓中概念术语解析
MYSQL入门与进阶(十一)
Some new ideas about time complexity