Simple web-app with python
Flask + Python
Nikita Penzin(Lozhnikov)
… is a widely used general-purpose, high-level
programming language - http://python.org
Python
The creator
Guido Van Rossum (1956 - …)
Employment: Google, Dropbox
“There is one way to do it right
...if you aren’t Dutchman”
The Zen of Python
Beautiful is better than ugly
Explicit is better than implicit
Simple is better than complex
Complex is better than complicated
Readability counts
Features
● dynamic type system
● automatic memory management
● large and comprehensive standard library
● lots of implementations
● beautiful, understandable, powerful syntax
● easy to learn
● TOP employers use it : Google, Yandex ...
Examples
print 'Hello, world!'
>>> Hello, world!
def fib(n):
if n < 2:
return n
return fib(n-2)+fib(n-1)
print fib(7)
>>> 13
a = 3
b = ‘hello’
print b * 3
>>> hellohellohello
Flask
Flask is a microframework for Python web-apps.
http://flask.pocoo.org/
created by Armin Ronacher
Flask based ‘Hello, world!’ app
1. Connect to a ‘flask’ wifi-hotspot from your
devices
2. Open your browser
3. Get to 192.168.xxx.xxx/
4. Have fun: get to 192.168.xxx.xxx/any text
e.g. 192.168.xxx.xxx/<h1>Hello, class<h1>
Explanation
flask.py
---------------------------------
from flask import Flask < import required modules
app = Flask(__name__) < create instance app of a class Flask
@app.route("/") < decorate method hello with app.route
def hello():
return "Hello World!"
@app.route("/<text>")
def hello_user(text):
return text
app.run(host=’0.0.0.0’) < call the run method on app
Credits
https://www.python.org/
http://flask.pocoo.org/
https://github.com/npenzin
https://twitter.com/npenzin
mailto: mail@mainpart.in
Any questions?

Python and Flask introduction for my classmates Презентация и введение в flask