Skip to content

Commit b589b43

Browse files
committed
Refactoring changes per Brett
1 parent 2b33f13 commit b589b43

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

.vscode/launch.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"request": "launch",
6565
"module": "flask",
6666
"env": {
67-
"FLASK_APP": "hello_app/app.py"
67+
"FLASK_APP": "hello_app.webapp"
6868
},
6969
"args": [
7070
"run",

hello_app/app.py

-5
This file was deleted.

hello_app/views.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
from datetime import datetime
22
from flask import Flask, render_template
3-
from hello_app import app
3+
from . import app
44

5-
@app.route('/')
5+
@app.route("/")
66
def home():
77
return render_template("home.html")
88

9-
@app.route('/about')
9+
@app.route("/about")
1010
def about():
1111
return render_template("about.html")
1212

13-
@app.route('/contact')
13+
@app.route("/contact")
1414
def contact():
1515
return render_template("contact.html")
1616

17-
@app.route('/hello/<name>')
17+
@app.route("/hello/<name>")
1818
def hello_there(name):
1919
return render_template(
2020
"hello_there.html",
2121
name=name,
2222
date=datetime.now()
2323
)
2424

25-
@app.route('/api/data')
25+
@app.route("/api/data")
2626
def get_data():
2727
return app.send_static_file('data.json')

hello_app/webapp.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"""Entry point for the application."""
2+
from . import app # For application discovery by the 'flask' command.
3+
from . import views # For import side-effects of setting up routes.
4+
5+
# Time-saver: output a URL to the VS Code terminal so you can easily Ctrl+click to open a browser
6+
# print('http://127.0.0.1:5000/hello/VSCode')

0 commit comments

Comments
 (0)