diff --git a/.console.py.swp b/.console.py.swp new file mode 100644 index 00000000000..8288ccb3ed1 Binary files /dev/null and b/.console.py.swp differ diff --git a/1-pack_web_static.py b/1-pack_web_static.py old mode 100644 new mode 100755 index f08a8aea659..5d746ad9f9b --- a/1-pack_web_static.py +++ b/1-pack_web_static.py @@ -18,5 +18,5 @@ def do_pack(): file_name = "versions/web_static_{}.tgz".format(date) local("tar -cvzf {} web_static".format(file_name)) return file_name - except: + except exception: return None diff --git a/2-do_deploy_web_static.py b/2-do_deploy_web_static.py old mode 100644 new mode 100755 index aa5ab7852c6..17bc0ff4c60 --- a/2-do_deploy_web_static.py +++ b/2-do_deploy_web_static.py @@ -26,5 +26,5 @@ def do_deploy(archive_path): run('rm -rf /data/web_static/current') run('ln -s {}{}/ /data/web_static/current'.format(path, no_ext)) return True - except: + except exception: return False diff --git a/3-deploy_web_static.py b/3-deploy_web_static.py old mode 100644 new mode 100755 index f7e7e254b5e..a61826cc1e5 --- a/3-deploy_web_static.py +++ b/3-deploy_web_static.py @@ -19,7 +19,7 @@ def do_pack(): file_name = "versions/web_static_{}.tgz".format(date) local("tar -cvzf {} web_static".format(file_name)) return file_name - except: + except exception: return None @@ -40,7 +40,7 @@ def do_deploy(archive_path): run('rm -rf /data/web_static/current') run('ln -s {}{}/ /data/web_static/current'.format(path, no_ext)) return True - except: + except exception: return False diff --git a/AUTHORS b/AUTHORS index 64b26acdc14..e25ffc357b0 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,6 +1,11 @@ -# This file lists all individuals having contributed content to the repository. - +<<<<<<< HEAD +Umeoke Ebubechukwu Jennifer Huang <133@holbertonschool.com> Alexa Orrico <210@holbertonschool.com> Joann Vuong <130@holbertonschool.com> +======= +# This file lists all individuals having contributed content to the repository. + +Umeoke Ebubechukwu +>>>>>>> 83d80d17ddf50a943cbc28a7ffeb264fdc6e23ac diff --git a/README.md b/README.md index f1d72de6355..a60d5da6d33 100644 --- a/README.md +++ b/README.md @@ -157,6 +157,7 @@ No known bugs at this time. Alexa Orrico - [Github](https://github.com/alexaorrico) / [Twitter](https://twitter.com/alexa_orrico) Jennifer Huang - [Github](https://github.com/jhuang10123) / [Twitter](https://twitter.com/earthtojhuang) +Umeoke Ebubechukwu Franklin Second part of Airbnb: Joann Vuong ## License Public Domain. No copy write protection. diff --git a/__pycache__/console.cpython-34.pyc b/__pycache__/console.cpython-34.pyc new file mode 100644 index 00000000000..66e055b8132 Binary files /dev/null and b/__pycache__/console.cpython-34.pyc differ diff --git a/__pycache__/console.cpython-38.pyc b/__pycache__/console.cpython-38.pyc new file mode 100644 index 00000000000..c360ffe81ea Binary files /dev/null and b/__pycache__/console.cpython-38.pyc differ diff --git a/api/v1/__pycache__/app.cpython-38.pyc b/api/v1/__pycache__/app.cpython-38.pyc new file mode 100644 index 00000000000..bbdda86b125 Binary files /dev/null and b/api/v1/__pycache__/app.cpython-38.pyc differ diff --git a/api/v1/app.py b/api/v1/app.py new file mode 100644 index 00000000000..26f5e0c1713 --- /dev/null +++ b/api/v1/app.py @@ -0,0 +1,39 @@ +#!/usr/bin/python3 +"""app""" +from flask import Flask, make_response, jsonify +from models import storage +from api.v1.views import app_views +from os import getenv +from flask_cors import CORS + + +app = Flask(__name__) +cors = CORS(app, resources={r"/api/*": {"origins": "0.0.0.0"}}) + + +app.url_map.strict_slashes = False +app.register_blueprint(app_views) + + +@app.teardown_appcontext +def tear(self): + ''' closes storage engine ''' + storage.close() + + +@app.errorhandler(404) +def not_found(error): + ''' handles 404 error and gives json formatted response ''' + return make_response(jsonify({'error': 'Not found'}), 404) + + +if __name__ == '__main__': + if getenv("HBNB_API_HOST") is None: + HBNB_API_HOST = '0.0.0.0' + else: + HBNB_API_HOST = getenv("HBNB_API_HOST") + if getenv("HBNB_API_PORT") is None: + HBNB_API_PORT = 5000 + else: + HBNB_API_PORT = int(getenv("HBNB_API_PORT")) + app.run(host=HBNB_API_HOST, port=HBNB_API_PORT, threaded=True) diff --git a/console.py b/console.py index 4798f9ac76b..e133363e235 100755 --- a/console.py +++ b/console.py @@ -46,10 +46,10 @@ def _key_value_parser(self, args): else: try: value = int(value) - except: + except Exception: try: value = float(value) - except: + except Exception: continue new_dict[key] = value return new_dict @@ -140,12 +140,12 @@ def do_update(self, arg): if args[2] in integers: try: args[3] = int(args[3]) - except: + except Exception: args[3] = 0 elif args[2] in floats: try: args[3] = float(args[3]) - except: + except Exception: args[3] = 0.0 setattr(models.storage.all()[k], args[2], args[3]) models.storage.all()[k].save() @@ -160,5 +160,6 @@ def do_update(self, arg): else: print("** class doesn't exist **") + if __name__ == '__main__': HBNBCommand().cmdloop() diff --git a/file.json b/file.json new file mode 100644 index 00000000000..6359f2c463d --- /dev/null +++ b/file.json @@ -0,0 +1 @@ +{"Review.8b9aa70f-623f-484e-9a64-3790612abd72": {"updated_at": "2024-08-07T15:25:02.302310", "created_at": "2024-08-07T15:25:02.302310", "__class__": "Review", "id": "8b9aa70f-623f-484e-9a64-3790612abd72"}, "BaseModel.51be5f73-2420-4998-84a0-d4abb3b42031": {"__class__": "BaseModel", "updated_at": "2024-08-07T15:25:02.302341", "created_at": "2024-08-07T15:25:02.302341", "id": "51be5f73-2420-4998-84a0-d4abb3b42031"}, "Amenity.4945fcd0-ad39-4020-a9a2-7ba8543f7212": {"updated_at": "2024-08-07T15:25:02.302350", "created_at": "2024-08-07T15:25:02.302350", "__class__": "Amenity", "id": "4945fcd0-ad39-4020-a9a2-7ba8543f7212"}, "User.3dea4631-f42e-4651-b7d8-d641813bea7e": {"updated_at": "2024-08-07T15:25:02.302321", "created_at": "2024-08-07T15:25:02.302321", "__class__": "User", "id": "3dea4631-f42e-4651-b7d8-d641813bea7e"}, "State.e878ab93-91ea-4a03-a28c-3b6518d4570f": {"updated_at": "2024-08-07T15:25:02.302368", "created_at": "2024-08-07T15:25:02.302368", "__class__": "State", "id": "e878ab93-91ea-4a03-a28c-3b6518d4570f"}, "City.369b3b48-45c6-41f6-86b7-533828a7d1e5": {"updated_at": "2024-08-07T15:25:02.302359", "created_at": "2024-08-07T15:25:02.302359", "__class__": "City", "id": "369b3b48-45c6-41f6-86b7-533828a7d1e5"}, "Place.92d09af8-1dd7-435a-967a-9b9b90982b00": {"updated_at": "2024-08-07T15:25:02.302332", "created_at": "2024-08-07T15:25:02.302332", "__class__": "Place", "id": "92d09af8-1dd7-435a-967a-9b9b90982b00"}} \ No newline at end of file diff --git a/models/__pycache__/__init__.cpython-34.pyc b/models/__pycache__/__init__.cpython-34.pyc new file mode 100644 index 00000000000..4e9031ac842 Binary files /dev/null and b/models/__pycache__/__init__.cpython-34.pyc differ diff --git a/models/__pycache__/__init__.cpython-38.pyc b/models/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 00000000000..3c59c321841 Binary files /dev/null and b/models/__pycache__/__init__.cpython-38.pyc differ diff --git a/models/__pycache__/amenity.cpython-34.pyc b/models/__pycache__/amenity.cpython-34.pyc new file mode 100644 index 00000000000..fdc8af6b637 Binary files /dev/null and b/models/__pycache__/amenity.cpython-34.pyc differ diff --git a/models/__pycache__/amenity.cpython-38.pyc b/models/__pycache__/amenity.cpython-38.pyc new file mode 100644 index 00000000000..0d8d2844a1f Binary files /dev/null and b/models/__pycache__/amenity.cpython-38.pyc differ diff --git a/models/__pycache__/base_model.cpython-34.pyc b/models/__pycache__/base_model.cpython-34.pyc new file mode 100644 index 00000000000..41d820ed3e0 Binary files /dev/null and b/models/__pycache__/base_model.cpython-34.pyc differ diff --git a/models/__pycache__/base_model.cpython-38.pyc b/models/__pycache__/base_model.cpython-38.pyc new file mode 100644 index 00000000000..0087465bb6b Binary files /dev/null and b/models/__pycache__/base_model.cpython-38.pyc differ diff --git a/models/__pycache__/city.cpython-34.pyc b/models/__pycache__/city.cpython-34.pyc new file mode 100644 index 00000000000..30ef7b50420 Binary files /dev/null and b/models/__pycache__/city.cpython-34.pyc differ diff --git a/models/__pycache__/city.cpython-38.pyc b/models/__pycache__/city.cpython-38.pyc new file mode 100644 index 00000000000..ccaae386efb Binary files /dev/null and b/models/__pycache__/city.cpython-38.pyc differ diff --git a/models/__pycache__/place.cpython-34.pyc b/models/__pycache__/place.cpython-34.pyc new file mode 100644 index 00000000000..d553cc88efc Binary files /dev/null and b/models/__pycache__/place.cpython-34.pyc differ diff --git a/models/__pycache__/place.cpython-38.pyc b/models/__pycache__/place.cpython-38.pyc new file mode 100644 index 00000000000..c8f608da1d2 Binary files /dev/null and b/models/__pycache__/place.cpython-38.pyc differ diff --git a/models/__pycache__/review.cpython-34.pyc b/models/__pycache__/review.cpython-34.pyc new file mode 100644 index 00000000000..03498f17c7d Binary files /dev/null and b/models/__pycache__/review.cpython-34.pyc differ diff --git a/models/__pycache__/review.cpython-38.pyc b/models/__pycache__/review.cpython-38.pyc new file mode 100644 index 00000000000..80a8d57e5e3 Binary files /dev/null and b/models/__pycache__/review.cpython-38.pyc differ diff --git a/models/__pycache__/state.cpython-34.pyc b/models/__pycache__/state.cpython-34.pyc new file mode 100644 index 00000000000..fcfec065da6 Binary files /dev/null and b/models/__pycache__/state.cpython-34.pyc differ diff --git a/models/__pycache__/state.cpython-38.pyc b/models/__pycache__/state.cpython-38.pyc new file mode 100644 index 00000000000..fe5858f3793 Binary files /dev/null and b/models/__pycache__/state.cpython-38.pyc differ diff --git a/models/__pycache__/user.cpython-34.pyc b/models/__pycache__/user.cpython-34.pyc new file mode 100644 index 00000000000..5304de03e93 Binary files /dev/null and b/models/__pycache__/user.cpython-34.pyc differ diff --git a/models/__pycache__/user.cpython-38.pyc b/models/__pycache__/user.cpython-38.pyc new file mode 100644 index 00000000000..2d068123af2 Binary files /dev/null and b/models/__pycache__/user.cpython-38.pyc differ diff --git a/models/engine/__pycache__/__init__.cpython-34.pyc b/models/engine/__pycache__/__init__.cpython-34.pyc new file mode 100644 index 00000000000..e9c23e25759 Binary files /dev/null and b/models/engine/__pycache__/__init__.cpython-34.pyc differ diff --git a/models/engine/__pycache__/__init__.cpython-38.pyc b/models/engine/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 00000000000..7b9f52a2885 Binary files /dev/null and b/models/engine/__pycache__/__init__.cpython-38.pyc differ diff --git a/models/engine/__pycache__/db_storage.cpython-34.pyc b/models/engine/__pycache__/db_storage.cpython-34.pyc new file mode 100644 index 00000000000..04b80a48e5a Binary files /dev/null and b/models/engine/__pycache__/db_storage.cpython-34.pyc differ diff --git a/models/engine/__pycache__/file_storage.cpython-34.pyc b/models/engine/__pycache__/file_storage.cpython-34.pyc new file mode 100644 index 00000000000..94185f955a9 Binary files /dev/null and b/models/engine/__pycache__/file_storage.cpython-34.pyc differ diff --git a/models/engine/__pycache__/file_storage.cpython-38.pyc b/models/engine/__pycache__/file_storage.cpython-38.pyc new file mode 100644 index 00000000000..7f2c1f51e0e Binary files /dev/null and b/models/engine/__pycache__/file_storage.cpython-38.pyc differ diff --git a/models/engine/file_storage.py b/models/engine/file_storage.py index c8cb8c1764d..8a8c6db5026 100755 --- a/models/engine/file_storage.py +++ b/models/engine/file_storage.py @@ -55,7 +55,7 @@ def reload(self): jo = json.load(f) for key in jo: self.__objects[key] = classes[jo[key]["__class__"]](**jo[key]) - except: + except exception: pass def delete(self, obj=None): diff --git a/test_get_count.py b/test_get_count.py new file mode 100755 index 00000000000..3eb7486b928 --- /dev/null +++ b/test_get_count.py @@ -0,0 +1,11 @@ +#!/usr/bin/python3 +""" Tests the .get() function and .count() methods +""" +from models import storage +from models.state import State + +print("All objects: {}".format(storage.count())) +print("State objects: {}".format(storage.count(State))) + +first_state_id = list(storage.all(State).values())[0].id +print("First state: {}".format(storage.get(State, first_state_id))) diff --git a/test_params_create b/test_params_create new file mode 100644 index 00000000000..503857d4ba5 --- /dev/null +++ b/test_params_create @@ -0,0 +1,6 @@ +create State name="California" +create State name="Arizona" +all State + +create Place city_id="0001" user_id="0001" name="My_little_house" number_rooms=4 number_bathrooms=2 max_guest=10 price_by_night=300 latitude=37.773972 longitude=-122.431297 +all Place diff --git a/tests/__pycache__/__init__.cpython-38.pyc b/tests/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 00000000000..29719855be2 Binary files /dev/null and b/tests/__pycache__/__init__.cpython-38.pyc differ diff --git a/tests/__pycache__/test_console.cpython-34.pyc b/tests/__pycache__/test_console.cpython-34.pyc new file mode 100644 index 00000000000..a82db7a9616 Binary files /dev/null and b/tests/__pycache__/test_console.cpython-34.pyc differ diff --git a/tests/__pycache__/test_console.cpython-38.pyc b/tests/__pycache__/test_console.cpython-38.pyc new file mode 100644 index 00000000000..c9032d8f187 Binary files /dev/null and b/tests/__pycache__/test_console.cpython-38.pyc differ diff --git a/tests/test_models/__pycache__/__init__.cpython-34.pyc b/tests/test_models/__pycache__/__init__.cpython-34.pyc new file mode 100644 index 00000000000..a5503af2457 Binary files /dev/null and b/tests/test_models/__pycache__/__init__.cpython-34.pyc differ diff --git a/tests/test_models/__pycache__/__init__.cpython-38.pyc b/tests/test_models/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 00000000000..68de0a20181 Binary files /dev/null and b/tests/test_models/__pycache__/__init__.cpython-38.pyc differ diff --git a/tests/test_models/__pycache__/test_amenity.cpython-34.pyc b/tests/test_models/__pycache__/test_amenity.cpython-34.pyc new file mode 100644 index 00000000000..44b727453fc Binary files /dev/null and b/tests/test_models/__pycache__/test_amenity.cpython-34.pyc differ diff --git a/tests/test_models/__pycache__/test_amenity.cpython-38.pyc b/tests/test_models/__pycache__/test_amenity.cpython-38.pyc new file mode 100644 index 00000000000..272a6300137 Binary files /dev/null and b/tests/test_models/__pycache__/test_amenity.cpython-38.pyc differ diff --git a/tests/test_models/__pycache__/test_base_model.cpython-34.pyc b/tests/test_models/__pycache__/test_base_model.cpython-34.pyc new file mode 100644 index 00000000000..aa35c3f2b01 Binary files /dev/null and b/tests/test_models/__pycache__/test_base_model.cpython-34.pyc differ diff --git a/tests/test_models/__pycache__/test_base_model.cpython-38.pyc b/tests/test_models/__pycache__/test_base_model.cpython-38.pyc new file mode 100644 index 00000000000..0354b69b88c Binary files /dev/null and b/tests/test_models/__pycache__/test_base_model.cpython-38.pyc differ diff --git a/tests/test_models/__pycache__/test_city.cpython-34.pyc b/tests/test_models/__pycache__/test_city.cpython-34.pyc new file mode 100644 index 00000000000..0a793527a73 Binary files /dev/null and b/tests/test_models/__pycache__/test_city.cpython-34.pyc differ diff --git a/tests/test_models/__pycache__/test_city.cpython-38.pyc b/tests/test_models/__pycache__/test_city.cpython-38.pyc new file mode 100644 index 00000000000..0cea097944e Binary files /dev/null and b/tests/test_models/__pycache__/test_city.cpython-38.pyc differ diff --git a/tests/test_models/__pycache__/test_place.cpython-34.pyc b/tests/test_models/__pycache__/test_place.cpython-34.pyc new file mode 100644 index 00000000000..a8807689599 Binary files /dev/null and b/tests/test_models/__pycache__/test_place.cpython-34.pyc differ diff --git a/tests/test_models/__pycache__/test_place.cpython-38.pyc b/tests/test_models/__pycache__/test_place.cpython-38.pyc new file mode 100644 index 00000000000..11f78e7aa49 Binary files /dev/null and b/tests/test_models/__pycache__/test_place.cpython-38.pyc differ diff --git a/tests/test_models/__pycache__/test_review.cpython-34.pyc b/tests/test_models/__pycache__/test_review.cpython-34.pyc new file mode 100644 index 00000000000..c66e6d2ba2d Binary files /dev/null and b/tests/test_models/__pycache__/test_review.cpython-34.pyc differ diff --git a/tests/test_models/__pycache__/test_review.cpython-38.pyc b/tests/test_models/__pycache__/test_review.cpython-38.pyc new file mode 100644 index 00000000000..69bd90c8a87 Binary files /dev/null and b/tests/test_models/__pycache__/test_review.cpython-38.pyc differ diff --git a/tests/test_models/__pycache__/test_state.cpython-34.pyc b/tests/test_models/__pycache__/test_state.cpython-34.pyc new file mode 100644 index 00000000000..99d8f418a2d Binary files /dev/null and b/tests/test_models/__pycache__/test_state.cpython-34.pyc differ diff --git a/tests/test_models/__pycache__/test_state.cpython-38.pyc b/tests/test_models/__pycache__/test_state.cpython-38.pyc new file mode 100644 index 00000000000..6c35bcd0ffa Binary files /dev/null and b/tests/test_models/__pycache__/test_state.cpython-38.pyc differ diff --git a/tests/test_models/__pycache__/test_user.cpython-34.pyc b/tests/test_models/__pycache__/test_user.cpython-34.pyc new file mode 100644 index 00000000000..f5f6471d679 Binary files /dev/null and b/tests/test_models/__pycache__/test_user.cpython-34.pyc differ diff --git a/tests/test_models/__pycache__/test_user.cpython-38.pyc b/tests/test_models/__pycache__/test_user.cpython-38.pyc new file mode 100644 index 00000000000..cdad0361bc6 Binary files /dev/null and b/tests/test_models/__pycache__/test_user.cpython-38.pyc differ diff --git a/tests/test_models/test_engine/__pycache__/__init__.cpython-34.pyc b/tests/test_models/test_engine/__pycache__/__init__.cpython-34.pyc new file mode 100644 index 00000000000..67cdf820ef1 Binary files /dev/null and b/tests/test_models/test_engine/__pycache__/__init__.cpython-34.pyc differ diff --git a/tests/test_models/test_engine/__pycache__/__init__.cpython-38.pyc b/tests/test_models/test_engine/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 00000000000..875e52eaaf0 Binary files /dev/null and b/tests/test_models/test_engine/__pycache__/__init__.cpython-38.pyc differ diff --git a/tests/test_models/test_engine/__pycache__/test_db_storage.cpython-34.pyc b/tests/test_models/test_engine/__pycache__/test_db_storage.cpython-34.pyc new file mode 100644 index 00000000000..eee0e6a918c Binary files /dev/null and b/tests/test_models/test_engine/__pycache__/test_db_storage.cpython-34.pyc differ diff --git a/tests/test_models/test_engine/__pycache__/test_db_storage.cpython-38.pyc b/tests/test_models/test_engine/__pycache__/test_db_storage.cpython-38.pyc new file mode 100644 index 00000000000..2c36676e057 Binary files /dev/null and b/tests/test_models/test_engine/__pycache__/test_db_storage.cpython-38.pyc differ diff --git a/tests/test_models/test_engine/__pycache__/test_file_storage.cpython-34.pyc b/tests/test_models/test_engine/__pycache__/test_file_storage.cpython-34.pyc new file mode 100644 index 00000000000..659fc950b93 Binary files /dev/null and b/tests/test_models/test_engine/__pycache__/test_file_storage.cpython-34.pyc differ diff --git a/tests/test_models/test_engine/__pycache__/test_file_storage.cpython-38.pyc b/tests/test_models/test_engine/__pycache__/test_file_storage.cpython-38.pyc new file mode 100644 index 00000000000..56ecc0d04d5 Binary files /dev/null and b/tests/test_models/test_engine/__pycache__/test_file_storage.cpython-38.pyc differ diff --git a/web_flask/0-hello_route.py b/web_flask/0-hello_route.py index 194749fecd4..d42285b19c6 100755 --- a/web_flask/0-hello_route.py +++ b/web_flask/0-hello_route.py @@ -12,5 +12,6 @@ def index(): """returns Hello HBNB!""" return 'Hello HBNB!' + if __name__ == '__main__': app.run(host='0.0.0.0', port='5000') diff --git a/web_flask/1-hbnb_route.py b/web_flask/1-hbnb_route.py index f1829cfc6dc..67c53c9ad88 100755 --- a/web_flask/1-hbnb_route.py +++ b/web_flask/1-hbnb_route.py @@ -18,5 +18,6 @@ def hbnb(): """returns HBNB""" return 'HBNB' + if __name__ == '__main__': app.run(host='0.0.0.0', port='5000') diff --git a/web_flask/10-hbnb_filters.py b/web_flask/10-hbnb_filters.py index b6d8e50f797..330308ca7d7 100755 --- a/web_flask/10-hbnb_filters.py +++ b/web_flask/10-hbnb_filters.py @@ -23,5 +23,6 @@ def teardown_db(exception): """closes the storage on teardown""" storage.close() + if __name__ == '__main__': app.run(host='0.0.0.0', port='5000') diff --git a/web_flask/2-c_route.py b/web_flask/2-c_route.py index bb3818a09b2..fd6b7337453 100755 --- a/web_flask/2-c_route.py +++ b/web_flask/2-c_route.py @@ -24,5 +24,6 @@ def cisfun(text): """display “C ” followed by the value of the text variable""" return 'C ' + text.replace('_', ' ') + if __name__ == '__main__': app.run(host='0.0.0.0', port='5000') diff --git a/web_flask/3-python_route.py b/web_flask/3-python_route.py index caf0f632694..ea64256b41d 100755 --- a/web_flask/3-python_route.py +++ b/web_flask/3-python_route.py @@ -31,5 +31,6 @@ def pythoniscool(text='is cool'): """display “Python ”, followed by the value of the text variable""" return 'Python ' + text.replace('_', ' ') + if __name__ == '__main__': app.run(host='0.0.0.0', port='5000') diff --git a/web_flask/4-number_route.py b/web_flask/4-number_route.py index f2948b12e11..6f48dd1eaac 100755 --- a/web_flask/4-number_route.py +++ b/web_flask/4-number_route.py @@ -37,5 +37,6 @@ def imanumber(n): """display “n is a number” only if n is an integer""" return "{:d} is a number".format(n) + if __name__ == '__main__': app.run(host='0.0.0.0', port='5000') diff --git a/web_flask/5-number_template.py b/web_flask/5-number_template.py index 17841a1a3a7..2100c9dbce7 100755 --- a/web_flask/5-number_template.py +++ b/web_flask/5-number_template.py @@ -43,5 +43,6 @@ def numbersandtemplates(n): """display a HTML page only if n is an integer""" return render_template('5-number.html', n=n) + if __name__ == '__main__': app.run(host='0.0.0.0', port='5000') diff --git a/web_flask/6-number_odd_or_even.py b/web_flask/6-number_odd_or_even.py index 7875c4c7b32..f800a0ed10c 100755 --- a/web_flask/6-number_odd_or_even.py +++ b/web_flask/6-number_odd_or_even.py @@ -54,5 +54,6 @@ def numbersandevenness(n): return render_template('6-number_odd_or_even.html', n=n, evenness=evenness) + if __name__ == '__main__': app.run(host='0.0.0.0', port='5000') diff --git a/web_flask/7-states_list.py b/web_flask/7-states_list.py index fa9ae29ae54..6926a0bd137 100755 --- a/web_flask/7-states_list.py +++ b/web_flask/7-states_list.py @@ -21,5 +21,6 @@ def teardown_db(exception): """closes the storage on teardown""" storage.close() + if __name__ == '__main__': app.run(host='0.0.0.0', port='5000') diff --git a/web_flask/8-cities_by_states.py b/web_flask/8-cities_by_states.py index 3d2ae2b733a..4eda12618b5 100755 --- a/web_flask/8-cities_by_states.py +++ b/web_flask/8-cities_by_states.py @@ -21,5 +21,6 @@ def teardown_db(exception): """closes the storage on teardown""" storage.close() + if __name__ == '__main__': app.run(host='0.0.0.0', port='5000') diff --git a/web_flask/9-states.py b/web_flask/9-states.py index cf9f5a704ce..b276906a4a3 100755 --- a/web_flask/9-states.py +++ b/web_flask/9-states.py @@ -24,5 +24,6 @@ def teardown_db(exception): """closes the storage on teardown""" storage.close() + if __name__ == '__main__': app.run(host='0.0.0.0', port='5000')