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/bash

export FLASK_APP=app.py
export FLASK_DEBUG=
flask run

app.py:

from flask import Flask
app = 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/<name>')
def say_hello(name=None):
return 'Hello {}'.format(user)

[Python] Create a minimal website in Python using the Flask Microframework的更多相关文章

  1. [Python] Create Unique Unordered Collections in Python with Set

    A set is an unordered collection with no duplicate items in Python. In this lesson, you will learn h ...

  2. [Python] Create a Log for your Python application

    Print statements will get you a long way in monitoring the behavior of your application, but logging ...

  3. The Python web services developer: XML-RPC for Python

    原文地址:http://www.ibm.com/developerworks/webservices/library/ws-pyth10/index.html 摘要:概括地说,您可以将 XML-RPC ...

  4. Python开发【第一篇】Python基础之自定义模块和内置模块

    为什么要有模块,将代码归类.模块,用一砣代码实现了某个功能的代码集合. Python中叫模块,其他语言叫类库. 类似于函数式编程和面向过程编程,函数式编程则完成一个功能,其他代码用来调用即可,提供了代 ...

  5. 精通 Oracle+Python,第 6 部分:Python 支持 XML

    无可辩驳的是,XML 现在是软件中信息交换的实际标准. 因此,Oracle 数据库附带了各种与 XML 相关的增强和工具,它们统称为 Oracle XML DB.XML DB 包含一系列嵌入到数据库中 ...

  6. python基础系列教程——Python的安装与测试:python的IDE工具PyDev和pycharm,anaconda

    ---恢复内容开始--- python基础系列教程——Python的安装与测试:python的IDE工具PyDev和pycharm,anaconda 从头开启python的开发环境搭建.安装比较简单, ...

  7. Introspection in Python How to spy on your Python objects Guide to Python introspection

    Guide to Python introspection https://www.ibm.com/developerworks/library/l-pyint/ Guide to Python in ...

  8. [Python + Unit Testing] Write Your First Python Unit Test with pytest

    In this lesson you will create a new project with a virtual environment and write your first unit te ...

  9. PYTHON 100days学习笔记007-1:python数据类型补充(1)

    目录 day007:python数据类型补充(1) 1.数字Number 1.1 Python 数字类型转换 1.2 Python 数字运算 1.3 数学函数 1.4 随机数函数 1.5 三角函数 1 ...

随机推荐

  1. Java图形用户界面编程

    1.Java图形用户界面编程概述 JavaAPI中提供了两套组件用于支持编写图形用户界面:AWT(抽象窗口包)和Swing 2.  容器(Container):重量级容器和轻量级容器(一个容器可以放置 ...

  2. PCB MongoDB 数据库 Collection集合导出与导入

    由于一直以来用微软可视化图形界面习惯了,而MongoDB是命令式操作,而用系统自带CMD操作不方便, 这里介绍一款CMD的替代品,大小100多M. Cmder工具下载  https://github. ...

  3. GStreamer系列 - 基本介绍

    什么是Gstreamer? Gstreamer是一个支持Windows,Linux,Android, iOS的跨平台的多媒体框架,应用程序可以通过管道(Pipeline)的方式,将多媒体处理的各个步骤 ...

  4. 编写linux 命令行实用工具 shell命令

    今天我想以带着问题的方法学习新的技术. 问题1: 编写一个命令 语法: command  options  path  expressions

  5. 取消VS2017窗口置顶

    今天打开VS2017,莫名其妙窗口置顶了,百度了一下如何取消窗口置顶,就是Ctrl+Alt+Esc组合键,就可以取消窗口置顶了,至于到底怎么会突然置顶的我也不知道emmm... /********** ...

  6. Java关于反射的用法

    一. 首先是准备一个需要反射的类 public class Person { private String name; private int age; public String sex; publ ...

  7. Js构造对象-添加方法的三种方式

    Js构造函数添加方法有多种方案,来看一个混合方式构造函数的例子:申明person构造函数,有两个属性,name,qq.在原型上添加方法showname.这是最常用的方法. <script> ...

  8. wx小程序开发 1:小程序代码构成

    官网学习地址:https://developers.weixin.qq.com/miniprogram/dev/quickstart/basic/introduction.html 1: 2:待续.. ...

  9. codeforces 467C George and Job(简单dp,看了题解抄一遍)

    题目 参考了网页:http://www.xue163.com/exploit/180/1802901.html //看了题解,抄了一遍,眼熟一下,增加一点熟练度 //dp[i][j]表示是前i个数选出 ...

  10. SSO 单点登录解决方案

    转自:http://www.blogjava.net/Jack2007/archive/2014/03/11/191795.html 1 什么是单点登陆      单点登录(Single Sign O ...