Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions HWs/DmitriyK/HM1/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from flask import Flask

app = Flask(__name__)


@app.route("/")
def home():
return "Hello world!"


@app.route("/user_name/<name>")

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше добавляйте / в конце маршрута. В этом случае Flask сам будет перенаправлять на нужный маршрут если слеша нет

Suggested change
@app.route("/user_name/<name>")
@app.route("/user_name/<name>/")

def hello_user(name):
print(name, type(name))
return f"{name}"


if __name__ == "__main__":
app.run(debug=True, host="0.0.0.0")
Binary file added HWs/DmitriyK/HM1/screenshots1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added HWs/DmitriyK/HM1/screenshots2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.