博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[Python] Create a minimal website in Python using the Flask Microframework
阅读量:4671 次
发布时间:2019-06-09

本文共 709 字,大约阅读时间需要 2 分钟。

How to install Flask Use Flask to create a minimal website Build routes in Flask to respond to website endpoints Use Variable Rules to pass parts of the URL to your functions as keyword parameters

Install:

pip install Flask

 

Development Mode:

run_local.sh:

#!/bin/bashexport FLASK_APP=app.pyexport FLASK_DEBUG=1flask run

 

app.py:

from flask import Flaskapp = Flask(__name__)@app.route('/')def hello_world():    return 'Hello world!'@app.route('/foo/')def foo():    return 'The foo page'@app.route('/bar')def bar():    return 'The bar page'@app.route('/hello/')@app.route('/hello/
')def say_hello(name=None): return 'Hello {}'.format(user)

 

转载于:https://www.cnblogs.com/Answer1215/p/8973838.html

你可能感兴趣的文章
GraphQL实战经验和性能问题的解决方案
查看>>
MySql大数据量恢复
查看>>
java-字符串反转
查看>>
获取一个目录下的所有文件
查看>>
微软发布Sample Browser for Windows 8版:5000示例代码,"触手可及"
查看>>
Windows 10 使用问题
查看>>
linux xargs命令
查看>>
用CSS3实现图像风格
查看>>
转载--黎曼
查看>>
mysql的建表语句
查看>>
免费的HTML5版uploadify
查看>>
机器学习之路:python 集成分类器 随机森林分类RandomForestClassifier 梯度提升决策树分类GradientBoostingClassifier 预测泰坦尼克号幸存者...
查看>>
通过onkeydown事件来控制只允许数字
查看>>
Python实现常用的数据结构
查看>>
snort简介以及在Ubuntu下的安装
查看>>
从SVN资源库下载项目
查看>>
Class.isAssignableFrom(Class clz)方法 与 instanceof 关键字的区别
查看>>
php克隆 自动加载
查看>>
删除同目录下面txt文件(利用os,fnmacth模块)
查看>>
sqlserver 按日、周、月统计方法
查看>>