Skip to content

Touch up formatting #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
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
7 changes: 5 additions & 2 deletions hello_app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
from flask import Flask
app = Flask(__name__)
import flask


# Defined here to prevent circular imports.
app = flask.Flask(__name__)
5 changes: 3 additions & 2 deletions hello_app/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from hello_app import app
from hello_app import views
"""Entry point for the application."""
from hello_app import app # For application discovery by the 'flask' command.
from hello_app 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')
36 changes: 20 additions & 16 deletions hello_app/views.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
from datetime import datetime
from flask import Flask, render_template
import datetime

import flask

from hello_app import app

@app.route('/')

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


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

@app.route('/contact')

@app.route("/contact")
def contact():
return render_template("contact.html")
return flask.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()
)
date = datetime.datetime.now()
return flask.render_template("hello_there.html", name=name, date=date)


@app.route('/api/data')
@app.route("/api/data")
def get_data():
return app.send_static_file('data.json')
return app.send_static_file("data.json")
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Flask~=1.0.2