-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
49 changed files
with
1,423 additions
and
0 deletions.
There are no files selected for viewing
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,14 @@ | ||
#!/usr/bin/python3 | ||
""" Starts a Flash Web Application """ | ||
from flask import Flask | ||
app = Flask(__name__) | ||
|
||
|
||
@app.route('/', strict_slashes=False) | ||
def hello_hbnb(): | ||
""" Prints a Message when / is called """ | ||
return 'Hello HBNB!' | ||
|
||
if __name__ == "__main__": | ||
""" Main Function """ | ||
app.run(host='0.0.0.0', port=5000) |
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,20 @@ | ||
#!/usr/bin/python3 | ||
""" Starts a Flash Web Application HBNB""" | ||
from flask import Flask | ||
app = Flask(__name__) | ||
|
||
|
||
@app.route('/', strict_slashes=False) | ||
def hello_hbnb(): | ||
""" Prints a Message when / is called """ | ||
return 'Hello HBNB!' | ||
|
||
|
||
@app.route('/hbnb', strict_slashes=False) | ||
def hbnb(): | ||
""" Prints a Message when /hbnb is called """ | ||
return 'HBNB' | ||
|
||
if __name__ == "__main__": | ||
""" Main Function """ | ||
app.run(host='0.0.0.0', port=5000) |
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,40 @@ | ||
#!/usr/bin/python3 | ||
""" Starts a Flash Web Application """ | ||
from models import storage | ||
from models.state import State | ||
from models.city import City | ||
from models.amenity import Amenity | ||
from os import environ | ||
from flask import Flask, render_template | ||
app = Flask(__name__) | ||
# app.jinja_env.trim_blocks = True | ||
# app.jinja_env.lstrip_blocks = True | ||
|
||
|
||
@app.teardown_appcontext | ||
def close_db(error): | ||
""" Remove the current SQLAlchemy Session """ | ||
storage.close() | ||
|
||
|
||
@app.route('/hbnb_filters', strict_slashes=False) | ||
def hbnb_filter(): | ||
""" HBNB filters """ | ||
states = storage.all(State).values() | ||
states = sorted(states, key=lambda k: k.name) | ||
st_ct = [] | ||
|
||
for state in states: | ||
st_ct.append([state, sorted(state.cities, key=lambda k: k.name)]) | ||
|
||
amenities = storage.all(Amenity).values() | ||
amenities = sorted(amenities, key=lambda k: k.name) | ||
|
||
return render_template('10-hbnb_filters.html', | ||
states=st_ct, | ||
amenities=amenities) | ||
|
||
|
||
if __name__ == "__main__": | ||
""" Main Function """ | ||
app.run(host='0.0.0.0', port=5000) |
Large diffs are not rendered by default.
Oops, something went wrong.
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,45 @@ | ||
#!/usr/bin/python3 | ||
""" Starts a Flash Web Application """ | ||
from models import storage | ||
from models.state import State | ||
from models.city import City | ||
from models.amenity import Amenity | ||
from models.place import Place | ||
from os import environ | ||
from flask import Flask, render_template | ||
app = Flask(__name__) | ||
# app.jinja_env.trim_blocks = True | ||
# app.jinja_env.lstrip_blocks = True | ||
|
||
|
||
@app.teardown_appcontext | ||
def close_db(error): | ||
""" Remove the current SQLAlchemy Session """ | ||
storage.close() | ||
|
||
|
||
@app.route('/hbnb', strict_slashes=False) | ||
def hbnb(): | ||
""" HBNB is alive! """ | ||
states = storage.all(State).values() | ||
states = sorted(states, key=lambda k: k.name) | ||
st_ct = [] | ||
|
||
for state in states: | ||
st_ct.append([state, sorted(state.cities, key=lambda k: k.name)]) | ||
|
||
amenities = storage.all(Amenity).values() | ||
amenities = sorted(amenities, key=lambda k: k.name) | ||
|
||
places = storage.all(Place).values() | ||
places = sorted(places, key=lambda k: k.name) | ||
|
||
return render_template('100-hbnb.html', | ||
states=st_ct, | ||
amenities=amenities, | ||
places=places) | ||
|
||
|
||
if __name__ == "__main__": | ||
""" Main Function """ | ||
app.run(host='0.0.0.0', port=5000) |
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,40 @@ | ||
#!/usr/bin/python3 | ||
""" Starts a Flash Web Application """ | ||
from models import storage | ||
from models.state import State | ||
from models.city import City | ||
from models.amenity import Amenity | ||
from os import environ | ||
from flask import Flask, render_template | ||
app = Flask(__name__) | ||
# app.jinja_env.trim_blocks = True | ||
# app.jinja_env.lstrip_blocks = True | ||
|
||
|
||
@app.teardown_appcontext | ||
def close_db(error): | ||
""" Remove the current SQLAlchemy Session """ | ||
storage.close() | ||
|
||
|
||
@app.route('/hbnb', strict_slashes=False) | ||
def states_state(): | ||
""" HBNB is alive! """ | ||
states = storage.all(State).values() | ||
states = sorted(states, key=lambda k: k.name) | ||
st_ct = [] | ||
|
||
for state in states: | ||
st_ct.append([state, sorted(state.cities, key=lambda k: k.name)]) | ||
|
||
amenities = storage.all(Amenity).values() | ||
amenities = sorted(amenities, key=lambda k: k.name) | ||
|
||
return render_template('100-hbnb.html', | ||
states=st_ct, | ||
amenities=amenities) | ||
|
||
|
||
if __name__ == "__main__": | ||
""" Main Function """ | ||
app.run(host='0.0.0.0', port=5000) |
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,26 @@ | ||
#!/usr/bin/python3 | ||
""" Starts a Flash Web Application C is FUN""" | ||
from flask import Flask | ||
app = Flask(__name__) | ||
|
||
|
||
@app.route('/', strict_slashes=False) | ||
def hello_hbnb(): | ||
""" Prints a Message when / is called """ | ||
return 'Hello HBNB!' | ||
|
||
|
||
@app.route('/hbnb', strict_slashes=False) | ||
def hbnb(): | ||
""" Prints a Message when /hbnb is called """ | ||
return 'HBNB' | ||
|
||
|
||
@app.route('/c/<text>', strict_slashes=False) | ||
def c_is_fun(text): | ||
""" Prints a Message when /c is called """ | ||
return "C " + text.replace('_', ' ') | ||
|
||
if __name__ == "__main__": | ||
""" Main Function """ | ||
app.run(host='0.0.0.0', port=5000) |
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 @@ | ||
#!/usr/bin/python3 | ||
""" Starts a Flash Web Application Python is Cool""" | ||
from flask import Flask | ||
app = Flask(__name__) | ||
|
||
|
||
@app.route('/', strict_slashes=False) | ||
def hello_hbnb(): | ||
""" Prints a Message when / is called """ | ||
return 'Hello HBNB!' | ||
|
||
|
||
@app.route('/hbnb', strict_slashes=False) | ||
def hbnb(): | ||
""" Prints a Message when /hbnb is called """ | ||
return 'HBNB' | ||
|
||
|
||
@app.route('/c/<text>', strict_slashes=False) | ||
def c_is_fun(text): | ||
""" Prints a Message when /c is called """ | ||
return "C " + text.replace('_', ' ') | ||
|
||
|
||
@app.route('/python', strict_slashes=False) | ||
@app.route('/python/<text>', strict_slashes=False) | ||
def python_is_cool(text='is_cool'): | ||
""" Prints a Message when /python is called """ | ||
return "Python " + text.replace('_', ' ') | ||
|
||
if __name__ == "__main__": | ||
""" Main Function """ | ||
app.run(host='0.0.0.0', port=5000) |
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,39 @@ | ||
#!/usr/bin/python3 | ||
""" Starts a Flash Web Application Python is Cool""" | ||
from flask import Flask | ||
app = Flask(__name__) | ||
|
||
|
||
@app.route('/', strict_slashes=False) | ||
def hello_hbnb(): | ||
""" Prints a Message when / is called """ | ||
return 'Hello HBNB!' | ||
|
||
|
||
@app.route('/hbnb', strict_slashes=False) | ||
def hbnb(): | ||
""" Prints a Message when /hbnb is called """ | ||
return 'HBNB' | ||
|
||
|
||
@app.route('/c/<text>', strict_slashes=False) | ||
def c_is_fun(text): | ||
""" Prints a Message when /c is called """ | ||
return "C " + text.replace('_', ' ') | ||
|
||
|
||
@app.route('/python', strict_slashes=False) | ||
@app.route('/python/<text>', strict_slashes=False) | ||
def python_is_cool(text='is_cool'): | ||
""" Prints a Message when /python is called """ | ||
return "Python " + text.replace('_', ' ') | ||
|
||
|
||
@app.route('/number/<int:n>', strict_slashes=False) | ||
def is_n_number(n): | ||
""" Prints a Message when /number is called only if n is an int""" | ||
return "{:d} is a number".format(n) | ||
|
||
if __name__ == "__main__": | ||
""" Main Function """ | ||
app.run(host='0.0.0.0', port=5000) |
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,46 @@ | ||
#!/usr/bin/python3 | ||
""" Starts a Flash Web Application """ | ||
from flask import Flask, render_template | ||
app = Flask(__name__) | ||
|
||
|
||
@app.route('/', strict_slashes=False) | ||
def hello_hbnb(): | ||
""" Prints a Message when / is called """ | ||
return 'Hello HBNB!' | ||
|
||
|
||
@app.route('/hbnb', strict_slashes=False) | ||
def hbnb(): | ||
""" Prints a Message when /hbnb is called """ | ||
return 'HBNB' | ||
|
||
|
||
@app.route('/c/<text>', strict_slashes=False) | ||
def c_is_fun(text): | ||
""" Prints a Message when /c is called """ | ||
return "C " + text.replace('_', ' ') | ||
|
||
|
||
@app.route('/python', strict_slashes=False) | ||
@app.route('/python/<text>', strict_slashes=False) | ||
def python_is_cool(text='is_cool'): | ||
""" Prints a Message when /python is called """ | ||
return "Python " + text.replace('_', ' ') | ||
|
||
|
||
@app.route('/number/<int:n>', strict_slashes=False) | ||
def is_n_number(n): | ||
""" Prints a Message when /number is called only if n is an int""" | ||
return "{:d} is a number".format(n) | ||
|
||
|
||
@app.route('/number_template/<int:n>', strict_slashes=False) | ||
def number_template(n): | ||
""" display a HTML page only if n is an integer """ | ||
return render_template('5-number.html', value=n) | ||
|
||
|
||
if __name__ == "__main__": | ||
""" Main Function """ | ||
app.run(host='0.0.0.0', port=5000) |
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,54 @@ | ||
#!/usr/bin/python3 | ||
""" Starts a Flash Web Application """ | ||
from flask import Flask, render_template | ||
app = Flask(__name__) | ||
app.jinja_env.trim_blocks = True | ||
app.jinja_env.lstrip_blocks = True | ||
|
||
|
||
@app.route('/', strict_slashes=False) | ||
def hello_hbnb(): | ||
""" Prints a Message when / is called """ | ||
return 'Hello HBNB!' | ||
|
||
|
||
@app.route('/hbnb', strict_slashes=False) | ||
def hbnb(): | ||
""" Prints a Message when /hbnb is called """ | ||
return 'HBNB' | ||
|
||
|
||
@app.route('/c/<text>', strict_slashes=False) | ||
def c_is_fun(text): | ||
""" Prints a Message when /c is called """ | ||
return "C " + text.replace('_', ' ') | ||
|
||
|
||
@app.route('/python', strict_slashes=False) | ||
@app.route('/python/<text>', strict_slashes=False) | ||
def python_is_cool(text='is_cool'): | ||
""" Prints a Message when /python is called """ | ||
return "Python " + text.replace('_', ' ') | ||
|
||
|
||
@app.route('/number/<int:n>', strict_slashes=False) | ||
def is_n_number(n): | ||
""" Prints a Message when /number is called only if n is an int""" | ||
return "{:d} is a number".format(n) | ||
|
||
|
||
@app.route('/number_template/<int:n>', strict_slashes=False) | ||
def number_template(n): | ||
""" display a HTML page only if n is an integer """ | ||
return render_template('5-number.html', value=n) | ||
|
||
|
||
@app.route('/number_odd_or_even/<int:n>', strict_slashes=False) | ||
def odd_or_even(n): | ||
""" display a HTML page only if n is an integer """ | ||
return render_template('6-number_odd_or_even.html', value=n) | ||
|
||
|
||
if __name__ == "__main__": | ||
""" Main Function """ | ||
app.run(host='0.0.0.0', port=5000) |
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,27 @@ | ||
#!/usr/bin/python3 | ||
""" Starts a Flash Web Application """ | ||
from models import storage | ||
from models.state import State | ||
from flask import Flask, render_template | ||
app = Flask(__name__) | ||
# app.jinja_env.trim_blocks = True | ||
# app.jinja_env.lstrip_blocks = True | ||
|
||
|
||
@app.teardown_appcontext | ||
def close_db(error): | ||
""" Remove the current SQLAlchemy Session """ | ||
storage.close() | ||
|
||
|
||
@app.route('/states_list', strict_slashes=False) | ||
def states_list(): | ||
""" displays a HTML page with a list of states """ | ||
states = storage.all(State).values() | ||
states = sorted(states, key=lambda k: k.name) | ||
return render_template('7-states_list.html', states=states) | ||
|
||
|
||
if __name__ == "__main__": | ||
""" Main Function """ | ||
app.run(host='0.0.0.0', port=5000) |
Oops, something went wrong.