-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1d9c1dc
commit 597b747
Showing
11 changed files
with
430 additions
and
1 deletion.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from markupsafe import escape | ||
from flask import Flask, abort | ||
|
||
app = Flask(__name__) | ||
|
||
|
||
@app.route('/') | ||
@app.route('/index/') | ||
def hello(): | ||
return '<h1>Hello, World!</h1>' | ||
|
||
|
||
@app.route('/about/') | ||
def about(): | ||
return '<h3>This is a Flask web application.</h3>' | ||
|
||
|
||
@app.route('/capitalize/<word>/') | ||
def capitalize(word): | ||
return '<h1>{}</h1>'.format(escape(word.capitalize())) | ||
|
||
|
||
@app.route('/add/<int:n1>/<int:n2>/') | ||
def add(n1, n2): | ||
return '<h1>{}</h1>'.format(n1 + n2) | ||
|
||
|
||
@app.route('/users/<int:user_id>/') | ||
def greet_user(user_id): | ||
users = ['Bob', 'Jane', 'Adam'] | ||
try: | ||
return '<h2>Hi {}</h2>'.format(users[user_id]) | ||
except IndexError: | ||
abort(404) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from markupsafe import escape | ||
from flask import Flask, abort | ||
|
||
app = Flask(__name__) | ||
|
||
|
||
@app.route('/') | ||
@app.route('/index/') | ||
def hello(): | ||
return '<h1>Hello, World!</h1>' | ||
|
||
|
||
@app.route('/about/') | ||
def about(): | ||
return '<h3>This is a Flask web application.</h3>' | ||
|
||
|
||
@app.route('/capitalize/<word>/') | ||
def capitalize(word): | ||
return '<h1>{}</h1>'.format(escape(word.capitalize())) | ||
|
||
|
||
@app.route('/add/<int:n1>/<int:n2>/') | ||
def add(n1, n2): | ||
return '<h1>{}</h1>'.format(n1 + n2) | ||
|
||
|
||
@app.route('/users/<int:user_id>/') | ||
def greet_user(user_id): | ||
users = ['Bob', 'Jane', 'Adam'] | ||
try: | ||
return '<h2>Hi {}</h2>'.format(users[user_id]) | ||
except IndexError: | ||
abort(404) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from markupsafe import escape | ||
from flask import Flask, abort | ||
|
||
app = Flask(__name__) | ||
|
||
|
||
@app.route('/') | ||
@app.route('/index/') | ||
def hello(): | ||
return '<h1>Hello, World!</h1>' | ||
|
||
|
||
@app.route('/about/') | ||
def about(): | ||
return '<h3>This is a Flask web application.</h3>' | ||
|
||
|
||
@app.route('/capitalize/<word>/') | ||
def capitalize(word): | ||
return '<h1>{}</h1>'.format(escape(word.capitalize())) | ||
|
||
|
||
@app.route('/add/<int:n1>/<int:n2>/') | ||
def add(n1, n2): | ||
return '<h1>{}</h1>'.format(n1 + n2) | ||
|
||
|
||
@app.route('/users/<int:user_id>/') | ||
def greet_user(user_id): | ||
users = ['Bob', 'Jane', 'Adam'] | ||
try: | ||
return '<h2>Hi {}</h2>'.format(users[user_id]) | ||
except IndexError: | ||
abort(404) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# the below imports the Flask object from the flask package | ||
from flask import Flask | ||
|
||
# creating the Flask application instance and give it the name app | ||
app = Flask(__name__) | ||
|
||
# the decorator, @app.route, is being told with '/' that the function will respond to web requests for the URL '/' | ||
|
||
|
||
@app.route('/') | ||
# creates the 'index' page and the ability to navigate between pages | ||
@app.route('/index/') | ||
# creates the 'hello' function and then runs the phrase 'Hello, World!' through it | ||
def hello(): | ||
return '<h1>Hello, World!</h1>' | ||
|
||
# creates an 'about' page and function and runs the phrase through it | ||
|
||
|
||
@app.route('/about/') | ||
def about(): | ||
return '<h3>This is a Flask web application made by Caroline Sanicola.</h3>' | ||
|
||
# creates a 'contact' page and function and runs the phrase through it | ||
|
||
|
||
@app.route('/contact/') | ||
def contact(): | ||
return '<h3>If you would like to contact us, please don\'t.</h3>' | ||
|
||
|
||
if __name__ == '__main__': | ||
app.run(debug=True, host='0.0.0.0', port=80) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# the below imports the Flask object from the flask package | ||
from flask import Flask, | ||
|
||
# creating the Flask application instance and give it the name app | ||
app = Flask(__name__) | ||
|
||
# the decorator, @app.route, is being told with '/' that the function will respond to web requests for the URL '/' | ||
|
||
|
||
@app.route('/') | ||
# creates the 'index' page and the ability to navigate between pages | ||
@app.route('/index/') | ||
# creates the 'hello' function and then runs the phrase 'Hello, World!' through it | ||
def hello(): | ||
return '<h1>Hello, World!</h1>' | ||
|
||
# creates an 'about' page and function and runs the phrase through it | ||
|
||
|
||
@app.route('/about/') | ||
def about(): | ||
return '<h3>This is a Flask web application made by Caroline Sanicola.</h3>' | ||
|
||
# creates a 'contact' page and function and runs the phrase through it | ||
|
||
|
||
@app.route('/contact/') | ||
def contact(): | ||
return '<h3>If you would like to contact us, please don\'t.</h3>' | ||
|
||
|
||
if __name__ == '__main__': | ||
app.run(debug=True, host='0.0.0.0', port=80) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# the below imports the Flask object from the flask package | ||
from flask import Flask, abort | ||
|
||
# creating the Flask application instance and give it the name app | ||
app = Flask(__name__) | ||
|
||
# the decorator, @app.route, is being told with '/' that the function will respond to web requests for the URL '/' | ||
|
||
|
||
@app.route('/') | ||
# creates the 'index' page and the ability to navigate between pages | ||
@app.route('/index/') | ||
# creates the 'hello' function and then runs the phrase 'Hello, World!' through it | ||
def hello(): | ||
return '<h1>Hello, World!</h1>' | ||
|
||
# creates an 'about' page and function and runs the phrase through it | ||
|
||
|
||
@app.route('/about/') | ||
def about(): | ||
return '<h3>This is a Flask web application made by Caroline Sanicola.</h3>' | ||
|
||
# creates a 'contact' page and function and runs the phrase through it | ||
|
||
|
||
@app.route('/contact/') | ||
def contact(): | ||
return '<h3>If you would like to contact us, please don\'t.</h3>' | ||
|
||
|
||
if __name__ == '__main__': | ||
app.run(debug=True, host='0.0.0.0', port=80) |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from markupsafe import escape | ||
from flask import Flask, abort | ||
|
||
app = Flask(__name__) | ||
|
||
|
||
@app.route('/') | ||
@app.route('/index/') | ||
def hello(): | ||
return '<h1>Hello, World!</h1>' | ||
|
||
|
||
@app.route('/about/') | ||
def about(): | ||
return '<h3>This is a Flask web application.</h3>' | ||
|
||
|
||
@app.route('/capitalize/<word>/') | ||
def capitalize(word): | ||
return '<h1>{}</h1>'.format(escape(word.capitalize())) | ||
|
||
|
||
@app.route('/add/<int:n1>/<int:n2>/') | ||
def add(n1, n2): | ||
return '<h1>{}</h1>'.format(n1 + n2) | ||
|
||
|
||
@app.route('/users/<int:user_id>/') | ||
def greet_user(user_id): | ||
users = ['Bob', 'Jane', 'Adam'] | ||
try: | ||
return '<h2>Hi {}</h2>'.format(users[user_id]) | ||
except IndexError: | ||
abort(404) |
Oops, something went wrong.