GithubHelp home page GithubHelp logo

flask_mysql_blog's Introduction

Flask+mysql简单问答网站(实现公网可访问)

python版本3.8,提前安装好Mysql数据库

1.安装python包

pip install -r requirements.txt

2.修改配置文件config.py

  • Mysql数据库用户名和密码
  • 用于发送验证码的邮箱配置

​ 在设置->账户下开启服务,获取授权码

image-20230425175433004

3.初始化数据库

#只需要执行一次
flask db init 
# 将orm模型生成迁移脚本
flask db migrate
#将迁移脚本映射到数据库中
flask db upgrade

4.启动项目

#开启Debug模式
set FLASK_ENV=development
#开启flask
flask run

5.使用ngrok实现公网访问

注册账号并登录:ngrok - Online in One Line

按照官网提示操作即可,最重要的是获取Authtoken

image-20230425170538827

如果是Windows上操作,可直接点击ngrok.exe,然后在命令行中输入

ngrok config add-authtoken 【authtoken官网登录就可获取】
#flask端口号为5000
ngrok http 5000

image-20230425170459445

实现效果:

登录和注册界面

image-20230425170735322

image-20230425171011666

参考自B站视频:https://www.bilibili.com/video/BV17r4y1y7jJ?p=1&vd_source=5fa56c12fe9967e30fac13bd17123f89

flask_mysql_blog's People

Contributors

qhcv avatar

Stargazers

 avatar  avatar

Watchers

 avatar

flask_mysql_blog's Issues

requirements文件

alembic==1.12.1
blinker==1.7.0
click==8.1.7
colorama==0.4.6
Flask==3.0.0
Flask-Mail==0.9.1
Flask-Migrate==4.0.5
Flask-SQLAlchemy==3.1.1
greenlet==3.0.1
importlib-metadata==6.8.0
importlib-resources==6.1.1
itsdangerous==2.1.2
Jinja2==3.1.2
Mako==1.3.0
MarkupSafe==2.1.3
PyMySQL==1.1.0
SQLAlchemy==2.0.23
typing_extensions==4.8.0
Werkzeug==3.0.1
WTForms==3.1.1
zipp==3.17.0

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.