You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
zart2007 7c7f0b971c
1
2 years ago
example 修改忽略.idea 2 years ago
templates 删除 2 years ago
.gitignore 修改忽略.idea 2 years ago
LICENSE Initial commit 2 years ago
README.md 代码更新 2 years ago
app.py 代码更新 2 years ago
database.py 代码更新 2 years ago
models.py 城市信息更新 2 years ago
requeriment.txt 代码更新 2 years ago
setup.py 删除 2 years ago
test.txt 1 2 years ago
test_py_orm.py 代码更新 2 years ago

README.md

flask_web_obj

描述

使用python语言和flask开源框架建设一个小型网站

前置要求

会一点数据库 会一点HTML 会Python基础

准备工作

安装Flask及其依赖库

# 安装库
# click==8.1.3
# colorama==0.4.6
# Flask==2.2.3
# Flask-SQLAlchemy==3.0.3
# greenlet==2.0.2
# importlib-metadata==6.4.1
# itsdangerous==2.1.2
# Jinja2==3.1.2
# MarkupSafe==2.1.2
# PyMySQL==1.0.3
# SQLAlchemy==2.0.9
# typing-extensions==4.5.0
# Werkzeug==2.2.3
# zipp==3.15.0

MySQL数据库链接测试

替换下面 test_py_orm.py文件中的这一句为自己MySQL服务的账号密码和临时创建的数据库。 并在python环境下顺利运行test_py_orm.py

from flask import Flask
from flask_sqlalchemy import SQLAlchemy


app = Flask(__name__)
#设置连接数据库的URL
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://root:123123@127.0.0.1:3306/example'