Skip to content

Commit

Permalink
Refactoring changes per Brett
Browse files Browse the repository at this point in the history
  • Loading branch information
kraigb committed Jul 16, 2018
1 parent 2b33f13 commit b589b43
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "hello_app/app.py"
"FLASK_APP": "hello_app.webapp"
},
"args": [
"run",
Expand Down
5 changes: 0 additions & 5 deletions hello_app/app.py

This file was deleted.

12 changes: 6 additions & 6 deletions hello_app/views.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
from datetime import datetime
from flask import Flask, render_template
from hello_app import app
from . import app

@app.route('/')
@app.route("/")
def home():
return render_template("home.html")

@app.route('/about')
@app.route("/about")
def about():
return render_template("about.html")

@app.route('/contact')
@app.route("/contact")
def contact():
return render_template("contact.html")

@app.route('/hello/<name>')
@app.route("/hello/<name>")
def hello_there(name):
return render_template(
"hello_there.html",
name=name,
date=datetime.now()
)

@app.route('/api/data')
@app.route("/api/data")
def get_data():
return app.send_static_file('data.json')
6 changes: 6 additions & 0 deletions hello_app/webapp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""Entry point for the application."""
from . import app # For application discovery by the 'flask' command.
from . import views # For import side-effects of setting up routes.

# Time-saver: output a URL to the VS Code terminal so you can easily Ctrl+click to open a browser
# print('http://127.0.0.1:5000/hello/VSCode')

0 comments on commit b589b43

Please sign in to comment.