epam_diplom/flask_app.py

28 lines
779 B
Python
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
@app.route('/index')
def index():
return '<h1>Hello, World!</h1>'
@app.route('/sum/<int:a>/<int:b>')
def summa(a, b):
return str(a + b)
"""
Типы динамических переменных
string принимает любые строки (значение по умолчанию)
int принимает целые числа
float принимает числа с плавающей точкой
path принимает полный путь включая слэши и завершающий слэш
uuid принимает строки uuid (символьные id)
"""
if __name__ == "__main__":
app.run(host='127.0.0.1', port=8181)