美文网首页
Flask大型教程项目

Flask大型教程项目

作者: 王象 | 来源:发表于2018-03-21 14:43 被阅读0次

链接地址:
http://www.pythondoc.com/flask-mega-tutorial/helloworld.html

安装环境:
系统环境:ubuntu16.04+python3(3.5)
mkdir microblog
cd microblog
安装sudo apt-get install python-virtualenv
python3 -m venv flask(创建python 3的虚拟环境)
cd flask
cd bin
(若提示未安装pip则安装即可,pip3,pip都安装了)
./pip install flask(这里务必注意使用创建flask环境中pip安装)

简单测试环境安装结果:
mkdir ~/microblog/app/
cd app
vim init.py
from flask import Flask

app = Flask(name)
from app import views

vim views.py
from app import app

@app.route('/')
@app.route('/index')
def index():
return "Hello, World!"

cd ~/microblog
vim run.py

!flask/bin/python

from app import app
app.run(debug = True)

chmod a+x run.py

出现一下内容,代表成功

  • Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
  • Restarting with stat
  • Debugger is active!
  • Debugger PIN: 313-322-908

相关文章

网友评论

      本文标题:Flask大型教程项目

      本文链接:https://www.haomeiwen.com/subject/mwjgqftx.html