From af8866f73d4bdb23964fba8f210f2375ace4357e Mon Sep 17 00:00:00 2001 From: hakeem-hassan Date: Wed, 26 Jun 2024 21:28:52 -0400 Subject: [PATCH 1/8] update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3ce462902d67..676c56c1ae07 100644 --- a/README.md +++ b/README.md @@ -139,4 +139,4 @@ Usage: .update(<_id>, ) (hbnb) User.all() (hbnb) ["[User] (98bea5de-9cb0-4d78-8a9d-c4de03521c30) {'updated_at': datetime.datetime(2020, 2, 19, 21, 47, 29, 134362), 'name': 'Fred the Frog', 'age': 9, 'id': '98bea5de-9cb0-4d78-8a9d-c4de03521c30', 'created_at': datetime.datetime(2020, 2, 19, 21, 47, 29, 134343)}"] ``` -
\ No newline at end of file +
From d163f2998c9aef6285e9567f57cd1392d263fd94 Mon Sep 17 00:00:00 2001 From: hakeem-hassan Date: Sun, 14 Jul 2024 19:44:02 -0700 Subject: [PATCH 2/8] update --- 0-setup_web_static.sh | 19 +++++++++ 1-pack_web_static.py | 16 +++++++ 100-clean_web_static.py | 29 +++++++++++++ 101-setup_web_static.pp | 87 +++++++++++++++++++++++++++++++++++++++ 2-do_deploy_web_static.py | 39 ++++++++++++++++++ 3-deploy_web_static.py | 53 ++++++++++++++++++++++++ 6 files changed, 243 insertions(+) create mode 100755 0-setup_web_static.sh create mode 100755 1-pack_web_static.py create mode 100755 100-clean_web_static.py create mode 100644 101-setup_web_static.pp create mode 100755 2-do_deploy_web_static.py create mode 100755 3-deploy_web_static.py diff --git a/0-setup_web_static.sh b/0-setup_web_static.sh new file mode 100755 index 000000000000..8c9d2aea0464 --- /dev/null +++ b/0-setup_web_static.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# Installs Nginx if not installed +#+ Creates folders /data/web_static/shared +#+ and /data/releases/test if not exists +#+ /data/web_static/current linked to +#+ /data/web_static/releases/test/ +#+ Creates an /data/web_static/releases/test/index.html +#+ Configures Nginx to serve /data/web_static/current/ +#+ to hbnb_static + +sudo apt-get -y update +sudo apt-get -y upgrade +sudo apt-get -y install nginx +sudo mkdir -p /data/web_static/releases/test /data/web_static/shared +echo "Welcome to ALX Interns home" | sudo tee /data/web_static/releases/test/index.html +sudo ln -sf /data/web_static/releases/test/ /data/web_static/current +sudo chown -hR ubuntu:ubuntu /data/ +sudo sed -i '38i\\tlocation /hbnb_static/ {\n\t\talias /data/web_static/current/;\n\t}\n' /etc/nginx/sites-available/default +sudo service nginx start diff --git a/1-pack_web_static.py b/1-pack_web_static.py new file mode 100755 index 000000000000..f7a5cbbef15c --- /dev/null +++ b/1-pack_web_static.py @@ -0,0 +1,16 @@ +#!/usr/bin/python3 +"""Create funtion for generate tgz file.""" +from fabric.api import local +import time + + +def do_pack(): + """Gerenate tgz.""" + timestamp = time.strftime("%Y%m%d%H%M%S") + try: + local("mkdir -p versions") + local("tar -cvzf versions/web_static_{:s}.tgz web_static/". + format(timestamp)) + return ("versions/web_static_{:s}.tgz".format(timestamp)) + except FileNotFoundError: + return None diff --git a/100-clean_web_static.py b/100-clean_web_static.py new file mode 100755 index 000000000000..79a49ac71e00 --- /dev/null +++ b/100-clean_web_static.py @@ -0,0 +1,29 @@ +#!/usr/bin/python3 +""" + Deletes out of date archives +""" + +import os +from fabric.api import * + +env.hosts = ["3.235.239.225", "35.170.64.18"] +env.user = 'ubuntu' +env.identinty = '~/.ssh/school' + + +def do_clean(number=0): + """ + Delete out-of-date archives. + """ + number = 1 if int(number) == 0 else int(number) + + archives = sorted(os.listdir("versions")) + [archives.pop() for i in range(number)] + with lcd("versions"): + [local("rm ./{}".format(a)) for a in archives] + + with cd("/data/web_static/releases"): + archives = run("ls -tr").split() + archives = [a for a in archives if "web_static_" in a] + [archives.pop() for i in range(number)] + [run("rm -rf ./{}".format(a)) for a in archives] diff --git a/101-setup_web_static.pp b/101-setup_web_static.pp new file mode 100644 index 000000000000..0aaf0023ba0a --- /dev/null +++ b/101-setup_web_static.pp @@ -0,0 +1,87 @@ +# Configures web server to deploy static web +# Nginx configuration file +$nginx_conf = "server { + listen 80 default_server; + listen [::]:80 default_server; + add_header X-Served-By ${hostname}; + root /var/www/html; + index index.html index.htm; + location /hbnb_static { + alias /data/web_static/current; + index index.html index.htm; + } + location /redirect_me { + rewrite ^ https://www.youtube.com/watch?v=QH2-TGUlw\u4? permanent; + } + error_page 404 /404.html; + location /404 { + root /var/www/html; + internal; + } +}" + +package { 'nginx': + ensure => 'present', + provider => 'apt' +} -> + +file { '/data': + ensure => 'directory' +} -> + +file { '/data/web_static': + ensure => 'directory' +} -> + +file { '/data/web_static/releases': + ensure => 'directory' +} -> + +file { '/data/web_static/releases/test': + ensure => 'directory' +} -> + +file { '/data/web_static/shared': + ensure => 'directory' +} -> + +file { '/data/web_static/releases/test/index.html': + ensure => 'present', + content => "Welcome to ALX Internship Program\n" +} -> + +file { '/data/web_static/current': + ensure => 'link', + target => '/data/web_static/releases/test' +} -> + +exec { 'chown -R ubuntu:ubuntu /data/': + path => '/usr/bin/:/usr/local/bin/:/bin/' +} + +file { '/var/www': + ensure => 'directory' +} -> + +file { '/var/www/html': + ensure => 'directory' +} -> + +file { '/var/www/html/index.html': + ensure => 'present', + content => "Welcome to ALX Internship Program\n" +} -> + +file { '/var/www/html/404.html': + ensure => 'present', + content => "Ceci n'est pas une page\n" +} -> + +file { '/etc/nginx/sites-available/default': + ensure => 'present', + content => $nginx_conf +} -> + +exec { 'nginx restart': + path => '/etc/init.d/' +} diff --git a/2-do_deploy_web_static.py b/2-do_deploy_web_static.py new file mode 100755 index 000000000000..215455c1cdff --- /dev/null +++ b/2-do_deploy_web_static.py @@ -0,0 +1,39 @@ +#!/usr/bin/python3 +""" + Distributes an archive to our web servers, + using the function do_deploy + def do_deploy(archive_path): + Return False iff archive path doesn't exist +""" + +from fabric.api import put, run, env +from os.path import exists +env.hosts = ['3.235.239.225', '35.170.64.18'] +env.user = 'ubuntu' +env.identity = '~/.ssh/school' +env.password = None + + +def do_deploy(archive_path): + """ + Deploys an archive to a server + """ + if exists(archive_path) is False: + return False + try: + file_N = archive_path.split("/")[-1] + n = file_N.split(".")[0] + path = "/data/web_static/releases/" + put(archive_path, '/tmp/') + run('sudo mkdir -p {}{}/'.format(path, n)) + run('sudo tar -xzf /tmp/{} -C {}{}/'.format(file_N, path, n)) + run('sudo rm /tmp/{}'.format(file_N)) + run('sudo mv {0}{1}/web_static/* {0}{1}/'.format(path, n)) + run('sudo rm -rf {}{}/web_static'.format(path, n)) + run('sudo rm -rf /data/web_static/current') + run('sudo ln -s {}{}/ /data/web_static/current'.format(path, n)) + run('sudo chmod -R 755 /data/') + print("New version deployed!") + return True + except FileNotFoundError: + return False diff --git a/3-deploy_web_static.py b/3-deploy_web_static.py new file mode 100755 index 000000000000..48788b4b87f8 --- /dev/null +++ b/3-deploy_web_static.py @@ -0,0 +1,53 @@ +#!/usr/bin/python3 +""" + Creates and distributes an archive to the web servers +""" + +from fabric.api import env, local, put, run +from datetime import datetime +from os.path import exists, isdir +env.hosts = ['3.235.239.225', '35.170.64.18'] +env.user = 'ubuntu' +env.identity = '~/.ssh/school' + + +def do_pack(): + """generates a tgz archive""" + try: + date = datetime.now().strftime("%Y%m%d%H%M%S") + if isdir("versions") is False: + local("mkdir versions") + file_name = "versions/web_static_{}.tgz".format(date) + local("tar -cvzf {} web_static".format(file_name)) + return file_name + except FileNotFoundError: + return None + + +def do_deploy(archive_path): + """distributes an archive to the web servers""" + if exists(archive_path) is False: + return False + try: + file_n = archive_path.split("/")[-1] + no_ext = file_n.split(".")[0] + path = "/data/web_static/releases/" + put(archive_path, '/tmp/') + run('mkdir -p {}{}/'.format(path, no_ext)) + run('tar -xzf /tmp/{} -C {}{}/'.format(file_n, path, no_ext)) + run('rm /tmp/{}'.format(file_n)) + run('mv {0}{1}/web_static/* {0}{1}/'.format(path, no_ext)) + run('rm -rf {}{}/web_static'.format(path, no_ext)) + run('rm -rf /data/web_static/current') + run('ln -s {}{}/ /data/web_static/current'.format(path, no_ext)) + return True + except FileNotFoundError: + return False + + +def deploy(): + """creates and distributes an archive to the web servers""" + archive_path = do_pack() + if archive_path is None: + return False + return do_deploy(archive_path) From 112db330d9a8fe5f999afe1cea5a69760450fbda Mon Sep 17 00:00:00 2001 From: hakeem-hassan Date: Fri, 2 Aug 2024 14:45:18 -0700 Subject: [PATCH 3/8] update --- web_flask/static/images/icon.png | 1813 +++++++++++++++++++++++ web_flask/static/images/logo.png | 2330 ++++++++++++++++++++++++++++++ 2 files changed, 4143 insertions(+) create mode 100644 web_flask/static/images/icon.png create mode 100644 web_flask/static/images/logo.png diff --git a/web_flask/static/images/icon.png b/web_flask/static/images/icon.png new file mode 100644 index 000000000000..14b3272628f7 --- /dev/null +++ b/web_flask/static/images/icon.png @@ -0,0 +1,1813 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AirBnB_clone_v2/web_flask/static/images/icon.png at main · hardope/AirBnB_clone_v2 · GitHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ Skip to content + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ + + + + +
+ + + + + + + + + +
+
+
+ + + + + + + + + +
+ +
+ +
+ +
+ + + + / + + AirBnB_clone_v2 + + + Public +
+ + +
+ +
+ + +
+
+ +
+
+ + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ +
+
+ +
+ +
+

Footer

+ + + + +
+
+ + + + + © 2024 GitHub, Inc. + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + diff --git a/web_flask/static/images/logo.png b/web_flask/static/images/logo.png new file mode 100644 index 000000000000..54ef6cb12f8b --- /dev/null +++ b/web_flask/static/images/logo.png @@ -0,0 +1,2330 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AirBnB_clone_v2/web_flask/static/images/logo.png at main · hardope/AirBnB_clone_v2 · GitHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ Skip to content + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ + + + + +
+ + + + + + + + + +
+
+
+ + + + + + + + + +
+ +
+ +
+ +
+ + + + / + + AirBnB_clone_v2 + + + Public +
+ + +
+ +
+ + +
+
+ +
+
+ + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + +

Latest commit

 

History

History
executable file
9.64 KB

File metadata and controls

executable file
9.64 KB
logo.png
+
+ + + + +
+ +
+ +
+
+ +
+ +
+

Footer

+ + + + +
+
+ + + + + © 2024 GitHub, Inc. + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + From e513d8cde5f15355cdcb0c09080244824e020d55 Mon Sep 17 00:00:00 2001 From: hakeem-hassan Date: Fri, 2 Aug 2024 14:52:01 -0700 Subject: [PATCH 4/8] update --- web_flask/static/images/icon.png | 1813 ----------------------- web_flask/static/images/logo.png | 2330 ------------------------------ 2 files changed, 4143 deletions(-) delete mode 100644 web_flask/static/images/icon.png delete mode 100644 web_flask/static/images/logo.png diff --git a/web_flask/static/images/icon.png b/web_flask/static/images/icon.png deleted file mode 100644 index 14b3272628f7..000000000000 --- a/web_flask/static/images/icon.png +++ /dev/null @@ -1,1813 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AirBnB_clone_v2/web_flask/static/images/icon.png at main · hardope/AirBnB_clone_v2 · GitHub - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- Skip to content - - - - - - - - - - - -
-
- - - - - - - - - - - - - - -
- -
- - - - - - - - -
- - - - - -
- - - - - - - - - -
-
-
- - - - - - - - - -
- -
- -
- -
- - - - / - - AirBnB_clone_v2 - - - Public -
- - -
- -
- - -
-
- -
-
- - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - -
-
- - - - -
- -
- -
-
- -
- -
-

Footer

- - - - -
-
- - - - - © 2024 GitHub, Inc. - -
- - -
-
- - - - - - - - - - - - - - - - - - - -
- -
-
- - - diff --git a/web_flask/static/images/logo.png b/web_flask/static/images/logo.png deleted file mode 100644 index 54ef6cb12f8b..000000000000 --- a/web_flask/static/images/logo.png +++ /dev/null @@ -1,2330 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AirBnB_clone_v2/web_flask/static/images/logo.png at main · hardope/AirBnB_clone_v2 · GitHub - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- Skip to content - - - - - - - - - - - -
-
- - - - - - - - - - - - - - -
- -
- - - - - - - - -
- - - - - -
- - - - - - - - - -
-
-
- - - - - - - - - -
- -
- -
- -
- - - - / - - AirBnB_clone_v2 - - - Public -
- - -
- -
- - -
-
- -
-
- - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - -

Latest commit

 

History

History
executable file
9.64 KB

File metadata and controls

executable file
9.64 KB
logo.png
-
- - - - -
- -
- -
-
- -
- -
-

Footer

- - - - -
-
- - - - - © 2024 GitHub, Inc. - -
- - -
-
- - - - - - - - - - - - - - - - - - - -
- -
-
- - - From 000f1b0e307781d12a3082d404cd4ccf8895d951 Mon Sep 17 00:00:00 2001 From: hakeem-hassan Date: Fri, 2 Aug 2024 14:58:59 -0700 Subject: [PATCH 5/8] update --- web_flask/0-hello_route.py | 16 +++++++++ web_flask/1-hbnb_route.py | 22 ++++++++++++ web_flask/2-c_route.py | 28 +++++++++++++++ web_flask/3-python_route.py | 35 +++++++++++++++++++ web_flask/4-number_route.py | 41 ++++++++++++++++++++++ web_flask/5-number_template.py | 47 +++++++++++++++++++++++++ web_flask/6-number_odd_or_even.py | 58 +++++++++++++++++++++++++++++++ 7 files changed, 247 insertions(+) create mode 100644 web_flask/0-hello_route.py create mode 100644 web_flask/1-hbnb_route.py create mode 100644 web_flask/2-c_route.py create mode 100644 web_flask/3-python_route.py create mode 100644 web_flask/4-number_route.py create mode 100644 web_flask/5-number_template.py create mode 100644 web_flask/6-number_odd_or_even.py diff --git a/web_flask/0-hello_route.py b/web_flask/0-hello_route.py new file mode 100644 index 000000000000..56ee51c78833 --- /dev/null +++ b/web_flask/0-hello_route.py @@ -0,0 +1,16 @@ +#!/usr/bin/python3 +""" +start Flask application +""" + +from flask import Flask +app = Flask(__name__) + + +@app.route('/', strict_slashes=False) +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 new file mode 100644 index 000000000000..8a4130fbf016 --- /dev/null +++ b/web_flask/1-hbnb_route.py @@ -0,0 +1,22 @@ +#!/usr/bin/python3 +""" +start Flask application +""" + +from flask import Flask +app = Flask(__name__) + + +@app.route('/', strict_slashes=False) +def index(): + """returns Hello HBNB!""" + return 'Hello HBNB!' + + +@app.route('/hbnb', strict_slashes=False) +def hbnb(): + """returns HBNB""" + return 'HBNB' + +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 new file mode 100644 index 000000000000..553ca8f3908d --- /dev/null +++ b/web_flask/2-c_route.py @@ -0,0 +1,28 @@ +#!/usr/bin/python3 +""" +start Flask application +""" + +from flask import Flask +app = Flask(__name__) + + +@app.route('/', strict_slashes=False) +def index(): + """returns Hello HBNB!""" + return 'Hello HBNB!' + + +@app.route('/hbnb', strict_slashes=False) +def hbnb(): + """returns HBNB""" + return 'HBNB' + + +@app.route('/c/', strict_slashes=False) +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 new file mode 100644 index 000000000000..3d00c57d1d1b --- /dev/null +++ b/web_flask/3-python_route.py @@ -0,0 +1,35 @@ +#!/usr/bin/python3 +""" +start Flask application +""" + +from flask import Flask +app = Flask(__name__) + + +@app.route('/', strict_slashes=False) +def index(): + """returns Hello HBNB!""" + return 'Hello HBNB!' + + +@app.route('/hbnb', strict_slashes=False) +def hbnb(): + """returns HBNB""" + return 'HBNB' + + +@app.route('/c/', strict_slashes=False) +def cisfun(text): + """display “C ” followed by the value of the text variable""" + return 'C ' + text.replace('_', ' ') + + +@app.route('/python', strict_slashes=False) +@app.route('/python/', strict_slashes=False) +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 new file mode 100644 index 000000000000..bd31e31aafc0 --- /dev/null +++ b/web_flask/4-number_route.py @@ -0,0 +1,41 @@ +#!/usr/bin/python3 +""" +start Flask application +""" + +from flask import Flask +app = Flask(__name__) + + +@app.route('/', strict_slashes=False) +def index(): + """returns Hello HBNB!""" + return 'Hello HBNB!' + + +@app.route('/hbnb', strict_slashes=False) +def hbnb(): + """returns HBNB""" + return 'HBNB' + + +@app.route('/c/', strict_slashes=False) +def cisfun(text): + """display “C ” followed by the value of the text variable""" + return 'C ' + text.replace('_', ' ') + + +@app.route('/python', strict_slashes=False) +@app.route('/python/', strict_slashes=False) +def pythoniscool(text='is cool'): + """display “Python ”, followed by the value of the text variable""" + return 'Python ' + text.replace('_', ' ') + + +@app.route('/number/', strict_slashes=False) +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 new file mode 100644 index 000000000000..e2cc98a217be --- /dev/null +++ b/web_flask/5-number_template.py @@ -0,0 +1,47 @@ +#!/usr/bin/python3 +""" +start Flask application +""" + +from flask import Flask, render_template +app = Flask(__name__) + + +@app.route('/', strict_slashes=False) +def index(): + """returns Hello HBNB!""" + return 'Hello HBNB!' + + +@app.route('/hbnb', strict_slashes=False) +def hbnb(): + """returns HBNB""" + return 'HBNB' + + +@app.route('/c/', strict_slashes=False) +def cisfun(text): + """display “C ” followed by the value of the text variable""" + return 'C ' + text.replace('_', ' ') + + +@app.route('/python', strict_slashes=False) +@app.route('/python/', strict_slashes=False) +def pythoniscool(text='is cool'): + """display “Python ”, followed by the value of the text variable""" + return 'Python ' + text.replace('_', ' ') + + +@app.route('/number/', strict_slashes=False) +def imanumber(n): + """display “n is a number” only if n is an integer""" + return "{:d} is a number".format(n) + + +@app.route('/number_template/', strict_slashes=False) +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 new file mode 100644 index 000000000000..9ce62d613283 --- /dev/null +++ b/web_flask/6-number_odd_or_even.py @@ -0,0 +1,58 @@ +#!/usr/bin/python3 +""" +start Flask application +""" + +from flask import Flask, render_template +app = Flask(__name__) + + +@app.route('/', strict_slashes=False) +def index(): + """returns Hello HBNB!""" + return 'Hello HBNB!' + + +@app.route('/hbnb', strict_slashes=False) +def hbnb(): + """returns HBNB""" + return 'HBNB' + + +@app.route('/c/', strict_slashes=False) +def cisfun(text): + """display “C ” followed by the value of the text variable""" + return 'C ' + text.replace('_', ' ') + + +@app.route('/python', strict_slashes=False) +@app.route('/python/', strict_slashes=False) +def pythoniscool(text='is cool'): + """display “Python ”, followed by the value of the text variable""" + return 'Python ' + text.replace('_', ' ') + + +@app.route('/number/', strict_slashes=False) +def imanumber(n): + """display “n is a number” only if n is an integer""" + return "{:d} is a number".format(n) + + +@app.route('/number_template/', strict_slashes=False) +def numbersandtemplates(n): + """display a HTML page only if n is an integer""" + return render_template('5-number.html', n=n) + + +@app.route('/number_odd_or_even/', strict_slashes=False) +def numbersandevenness(n): + """display a HTML page only if n is an integer""" + if n % 2 == 0: + evenness = 'even' + else: + evenness = 'odd' + 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') From 2c51f27a15369f040b5af8d1d4bbdcf08c4057f0 Mon Sep 17 00:00:00 2001 From: hakeem-hassan Date: Sat, 3 Aug 2024 13:48:15 -0700 Subject: [PATCH 6/8] update --- web_flask/static/images/icon.png | 2330 ++++++++++++++++++++++++++++++ 1 file changed, 2330 insertions(+) create mode 100644 web_flask/static/images/icon.png diff --git a/web_flask/static/images/icon.png b/web_flask/static/images/icon.png new file mode 100644 index 000000000000..1cbae77f4fef --- /dev/null +++ b/web_flask/static/images/icon.png @@ -0,0 +1,2330 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AirBnB_clone_v2/web_flask/static/images/icon.png at main · hardope/AirBnB_clone_v2 · GitHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ Skip to content + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ + + + + +
+ + + + + + + + + +
+
+
+ + + + + + + + + +
+ +
+ +
+ +
+ + + + / + + AirBnB_clone_v2 + + + Public +
+ + +
+ +
+ + +
+
+ +
+
+ + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + +

Latest commit

 

History

History
executable file
2.89 KB

File metadata and controls

executable file
2.89 KB
icon.png
+
+ + + + +
+ +
+ +
+
+ +
+ +
+

Footer

+ + + + +
+
+ + + + + © 2024 GitHub, Inc. + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + From f4ff0c443a2b40f3d9532cec5cbe99450420971c Mon Sep 17 00:00:00 2001 From: hakeem-hassan Date: Sat, 3 Aug 2024 13:52:55 -0700 Subject: [PATCH 7/8] update --- web_flask/static/images/icon.png | 2330 ------------------------------ 1 file changed, 2330 deletions(-) delete mode 100644 web_flask/static/images/icon.png diff --git a/web_flask/static/images/icon.png b/web_flask/static/images/icon.png deleted file mode 100644 index 1cbae77f4fef..000000000000 --- a/web_flask/static/images/icon.png +++ /dev/null @@ -1,2330 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AirBnB_clone_v2/web_flask/static/images/icon.png at main · hardope/AirBnB_clone_v2 · GitHub - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- Skip to content - - - - - - - - - - - -
-
- - - - - - - - - - - - - - -
- -
- - - - - - - - -
- - - - - -
- - - - - - - - - -
-
-
- - - - - - - - - -
- -
- -
- -
- - - - / - - AirBnB_clone_v2 - - - Public -
- - -
- -
- - -
-
- -
-
- - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - -

Latest commit

 

History

History
executable file
2.89 KB

File metadata and controls

executable file
2.89 KB
icon.png
-
- - - - -
- -
- -
-
- -
- -
-

Footer

- - - - -
-
- - - - - © 2024 GitHub, Inc. - -
- - -
-
- - - - - - - - - - - - - - - - - - - -
- -
-
- - - From 8f7ff4b106c22a4260954734dbbc6ce844da6a00 Mon Sep 17 00:00:00 2001 From: hakeem-hassan Date: Sun, 4 Aug 2024 17:26:26 -0700 Subject: [PATCH 8/8] web implementation --- web_flask/0-hello_route.py | 0 web_flask/1-hbnb_route.py | 0 web_flask/2-c_route.py | 0 web_flask/3-python_route.py | 0 web_flask/4-number_route.py | 0 web_flask/5-number_template.py | 0 web_flask/6-number_odd_or_even.py | 0 web_flask/7-states_list.py | 26 +++ web_flask/8-cities_by_states.py | 30 +++ web_flask/9-states.py | 40 ++++ web_flask/README.md | 13 ++ web_flask/static/images/icon.png | Bin 0 -> 1150 bytes web_flask/static/images/logo.png | Bin 0 -> 9876 bytes web_flask/static/styles/103-common.css | 13 ++ web_flask/static/styles/103-filters.css | 101 +++++++++ web_flask/static/styles/103-footer.css | 10 + web_flask/static/styles/103-header.css | 18 ++ web_flask/static/styles/103-places.css | 209 ++++++++++++++++++ web_flask/static/styles/3-footer.css | 10 + web_flask/static/styles/3-header.css | 18 ++ web_flask/static/styles/4-common.css | 13 ++ web_flask/static/styles/6-filters.css | 103 +++++++++ web_flask/templates/10-hbnb_filters.html | 49 ++++ web_flask/templates/100-hbnb.html | 102 +++++++++ web_flask/templates/5-number.html | 9 + web_flask/templates/6-number_odd_or_even.html | 13 ++ web_flask/templates/7-states_list.html | 14 ++ web_flask/templates/8-cities_by_states.html | 20 ++ web_flask/templates/9-states.html | 26 +++ 29 files changed, 837 insertions(+) mode change 100644 => 100755 web_flask/0-hello_route.py mode change 100644 => 100755 web_flask/1-hbnb_route.py mode change 100644 => 100755 web_flask/2-c_route.py mode change 100644 => 100755 web_flask/3-python_route.py mode change 100644 => 100755 web_flask/4-number_route.py mode change 100644 => 100755 web_flask/5-number_template.py mode change 100644 => 100755 web_flask/6-number_odd_or_even.py create mode 100755 web_flask/7-states_list.py create mode 100755 web_flask/8-cities_by_states.py create mode 100755 web_flask/9-states.py create mode 100644 web_flask/README.md create mode 100755 web_flask/static/images/icon.png create mode 100755 web_flask/static/images/logo.png create mode 100644 web_flask/static/styles/103-common.css create mode 100644 web_flask/static/styles/103-filters.css create mode 100644 web_flask/static/styles/103-footer.css create mode 100644 web_flask/static/styles/103-header.css create mode 100644 web_flask/static/styles/103-places.css create mode 100644 web_flask/static/styles/3-footer.css create mode 100644 web_flask/static/styles/3-header.css create mode 100644 web_flask/static/styles/4-common.css create mode 100644 web_flask/static/styles/6-filters.css create mode 100644 web_flask/templates/10-hbnb_filters.html create mode 100644 web_flask/templates/100-hbnb.html create mode 100644 web_flask/templates/5-number.html create mode 100644 web_flask/templates/6-number_odd_or_even.html create mode 100644 web_flask/templates/7-states_list.html create mode 100644 web_flask/templates/8-cities_by_states.html create mode 100644 web_flask/templates/9-states.html diff --git a/web_flask/0-hello_route.py b/web_flask/0-hello_route.py old mode 100644 new mode 100755 diff --git a/web_flask/1-hbnb_route.py b/web_flask/1-hbnb_route.py old mode 100644 new mode 100755 diff --git a/web_flask/2-c_route.py b/web_flask/2-c_route.py old mode 100644 new mode 100755 diff --git a/web_flask/3-python_route.py b/web_flask/3-python_route.py old mode 100644 new mode 100755 diff --git a/web_flask/4-number_route.py b/web_flask/4-number_route.py old mode 100644 new mode 100755 diff --git a/web_flask/5-number_template.py b/web_flask/5-number_template.py old mode 100644 new mode 100755 diff --git a/web_flask/6-number_odd_or_even.py b/web_flask/6-number_odd_or_even.py old mode 100644 new mode 100755 diff --git a/web_flask/7-states_list.py b/web_flask/7-states_list.py new file mode 100755 index 000000000000..670317a51f55 --- /dev/null +++ b/web_flask/7-states_list.py @@ -0,0 +1,26 @@ +#!/usr/bin/python3 +"""Starts a Flask web application""" + +from models import storage +from models.state import State +from flask import Flask +from flask import render_template +app = Flask(__name__) + + +@app.route('/states_list', strict_slashes=False) +def states(): + """Returns a rendered html template + at the /states_list route, + listing all states""" + return render_template('7-states_list.html', + states=storage.all('State').values()) + + +@app.teardown_appcontext +def teardown(self): + """Removes the current SQLAlchemy Session""" + storage.close() + +if __name__ == '__main__': + app.run(host='0.0.0.0') diff --git a/web_flask/8-cities_by_states.py b/web_flask/8-cities_by_states.py new file mode 100755 index 000000000000..f3d07b60b1ae --- /dev/null +++ b/web_flask/8-cities_by_states.py @@ -0,0 +1,30 @@ +#!/usr/bin/python3 +"""Starts a Flask web application. +The application listens on 0.0.0.0, port 5000. +Routes: + /cities_by_states: HTML page with a list of all states and related cities. +""" +from models import storage +from flask import Flask +from flask import render_template + +app = Flask(__name__) + + +@app.route("/cities_by_states", strict_slashes=False) +def cities_by_states(): + """Displays an HTML page with a list of all states and related cities. + States/cities are sorted by name. + """ + states = storage.all("State") + return render_template("8-cities_by_states.html", states=states) + + +@app.teardown_appcontext +def teardown(exc): + """Remove the current SQLAlchemy session.""" + storage.close() + + +if __name__ == "__main__": + app.run(host="0.0.0.0") diff --git a/web_flask/9-states.py b/web_flask/9-states.py new file mode 100755 index 000000000000..ae5173ed1d63 --- /dev/null +++ b/web_flask/9-states.py @@ -0,0 +1,40 @@ +#!/usr/bin/python3 +"""Starts a Flask web application. +The application listens on 0.0.0.0, port 5000. +Routes: + /states: HTML page with a list of all State objects. + /states/: HTML page displaying the given state with . +""" +from models import storage +from flask import Flask +from flask import render_template + +app = Flask(__name__) + + +@app.route("/states", strict_slashes=False) +def states(): + """Displays an HTML page with a list of all States. + States are sorted by name. + """ + states = storage.all("State") + return render_template("9-states.html", state=states) + + +@app.route("/states/", strict_slashes=False) +def states_id(id): + """Displays an HTML page with info about , if it exists.""" + for state in storage.all("State").values(): + if state.id == id: + return render_template("9-states.html", state=state) + return render_template("9-states.html") + + +@app.teardown_appcontext +def teardown(exc): + """Remove the current SQLAlchemy session.""" + storage.close() + + +if __name__ == "__main__": + app.run(host="0.0.0.0") diff --git a/web_flask/README.md b/web_flask/README.md new file mode 100644 index 000000000000..519e7aec28ef --- /dev/null +++ b/web_flask/README.md @@ -0,0 +1,13 @@ +#Web_Flask Implementation + +##At the end of this project, you are expected to be able to explain to anyone, without the help of Google: + +What is a Web Framework +How to build a web framework with Flask +How to define routes in Flask +What is a route +How to handle variables in a route +What is a template +How to create a HTML response in Flask by using a template +How to create a dynamic template (loops, conditions…) +How to display in HTML data from a MySQL database diff --git a/web_flask/static/images/icon.png b/web_flask/static/images/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..7a4b2a9b3568d98290c0510fa649db9fc0e29715 GIT binary patch literal 1150 zcmZ`&O-vI}5FT1$A@b9U1dWPO5-VbW14;R@we5DhyWRf(gOyTBTZ({11f)@##-gOL zL?ulla8Nne5G8~I2QS8xBp$r!$!OwLHt87h7cmZaohmVS8A=VuNPsX(Fnv$CKK50cG%k50=ZlcJv}{OFc^wHv)K&M zXcW9&@1ImvRaMZ{)den>s~Y{R)oSHD9#5@WtptvvAP@*tU`{2P#b&b|QLELE%jF=O z%|d^Ff03)Vx3^xS(WH?li*Xsfp3hn>e4E**JgwL3@1w32#2>LNyM)@B6beO=KN5++ z#>R#SW2TXJDi(`XjE-KDm`!>uqxUaU?9dv|a|5`lCnhGu7K_D6@*%GTH4@F_el;A& zt@?bvZh{R49MHkM15fA!uXBG{vG_jK*m|)|@8cki-H zRruJb$bWCu?YxZN{d$b1sd?nKk(nTOKDfrm$6y@+LXcbrahz!nfL%8iA4txRFF zp=)oGGYqO3hF%JXhopUdeUM6}4ju=Bp*AvSZ8WWUc6BU$qEWRoeX=wE=7J$VprzFF zR;$I?+lIu}-I(<5=3?ZWE4n+6A}AGoaMb+GX#RKB>#)F3#QlnS(p& z1NMf@L<>b}a}K+yF@9@Us!}N*VBM`U+1dYc@8?M*5+tS!?=gryTElugp=o;N=1iJq literal 0 HcmV?d00001 diff --git a/web_flask/static/images/logo.png b/web_flask/static/images/logo.png new file mode 100755 index 0000000000000000000000000000000000000000..9b255c955550bd244d53bfe22edb1e5aa18f7b1d GIT binary patch literal 9876 zcmaKSWmsIzvhLt+0Rq9@8QeWsaJS&@KDfJkaEFj!!JXjl!JR>ayIZ)EefGD{{c-o5 zXU&p+s@|%uu3pvEwW5?2rO}WHkO2Syn#?B&Rme3S@)tyehn#EPg54pP42 znV=^>1i;=LWK8C1Z|C63?b8+*t^N{`fM*)%MVrIdwDk1f6S&%0o z3M&xEiJyhV!@~pU!2xu1v1DQ61`?uxX!<{0uy^_otb^;n%>*$Ri>I*@3mcI2ZVY`B#(^zqpIJG04$H-OGL=~%^Hhgx z-hKdk=Hq_DxzPE&KbY_Bz>Yh+C8oXQ^UWE(6CRJ#+5j4nhcnEO{#v&)o=2-eESI0t z-H8qxLEQG?A$^sU!AstNAnSQ{0sGy{954JRDJ>o5+C9E4nmznlQ=|Nz`7@Qz{aI>aVxn$VY``+5V zzP`J2Woj!#82GHBRr>AUZnMGH7Z-^Z6Is^PQ@H})ZwG7|N2iOW8`~Hd7#eEPNd&d| zK?fHxoi#NWFJ~{0*L%AoDethb$kSO27oOIu^abeY=t>t1YLYA}AWD8xSO0P+yt;?4 z2R(U;104r{dw-uE8ylNAK0Yq8ySEqD^Hs{#WNGB)=EfAD%yi}zf_aOU2jw9sRczn5@YJS^}VL{)jcei380?YaR&b0gnB@b+rOH}J`9}56D z9XRMs6M-b-2)L5%SDS8wj}KM4{Qb&rN6XZ{qnFf)KyT{7l~$>%%Vy%pVmp!^Zd9bh zK0KnmR@1AwEN`SS>;Cx#q4Y{hO47pDpT}*PQ%4qb$h~odNAF|Tf@Ql!ULWrXK>+U^ zU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)0AltyNV|hY88!+{r6$k@4Jm@0?l|CcM)G$szjGk|%jCyEW-ue<7 zX*LrdALvldTi1s|{?;8;Ol-FMqm+h*hAgKal=o`o(t$#$nVFCHDTbVRPky*{aHz|G z%A4&hF5AiOT%l4DxsLrj9~yLG{u^9qWok?WRD4z{ZtgoZf@Cn{)%u_YP<{^@HUrT0 zUv4J9{`^D-QW$M>JLbk>#mNFpC2Z-_R|R0&jI>4EQV3ioF73au^zb!pJ zHCmR*2heE5FR`#Ygeiv{mkJ<4uO4(@8r+>1qT5usfH%(BvBMm(^zv7?87n3PHDU~O zbOWg7R>aS=`GK9-T^u{WH>yoK$_mS}O@H)W$%$a{X3BnhxCN_jX^{eI7eLl4;*aJe zxKe?GGl#S&b+^@g)`t&OjBrLPFh*2G9ZteiaZ@f(gCS1YgaCqU@0)qFtN_F5)_|xr z{WB}|J>c0ke0+OL&<@aHvn7U*_w4HJ$4fN;1^|a9@@e^3ZS3Fg#AGBDC8|Ce1^*w{ C(Z%)v literal 0 HcmV?d00001 diff --git a/web_flask/static/styles/103-common.css b/web_flask/static/styles/103-common.css new file mode 100644 index 000000000000..cd9f953ee6ae --- /dev/null +++ b/web_flask/static/styles/103-common.css @@ -0,0 +1,13 @@ +body { + margin:0px; + padding:0px; + + color: #484848; + font-size: 14px; + font-family: Circular,"Helvetica Neue",Helvetica,Arial,sans-serif; +} + +.container { + max-width: 1000px; + margin: 30px auto; +} diff --git a/web_flask/static/styles/103-filters.css b/web_flask/static/styles/103-filters.css new file mode 100644 index 000000000000..10f686218bfe --- /dev/null +++ b/web_flask/static/styles/103-filters.css @@ -0,0 +1,101 @@ +.filters { + display: block; + background-color: white; + height: 70px; + width: 100%; + border: 1px solid #DDDDDD; + border-radius: 4px; +} + +.locations { + display: inline; + vertical-align: middle; + float: left; + height: 100%; + width: 25%; + + line-height: 20px; + border-right: 1px solid #DDDDDD; +} + +.filter_amenities { + display: inline; + vertical-align: middle; + height: 100%; + float: left; + width: 25%; + + line-height: 20px; +} + +.popover { + list-style-type: none; + display: none; + background-color: #FAFAFA; + width: 100%; + + margin-left: -1px; + margin-top: 8px; + padding: 25px 0px; + + border: 1px solid #DDDDDD; + border-radius: 4px; +} + +.locations:hover .popover { + display: inline-block; +} + +.filter_amenities:hover .popover { + display: inline-block; +} + +ul { + list-style-type: none; + padding: 0px; + padding-bottom: 20px; +} + +li { +} + +h2 { + font-size: 16px; + padding-left: 30px; + margin: 0px; +} + +h3 { + font-weight: 600; + margin-top: 12px; + margin-bottom: 5px; + padding-left: 45px; +} + +h4 { + font-size: 14px; + font-weight: 400; + margin-top: 5px; + margin-bottom: 5px; + padding-left: 45px; +} + +button { + color: #FFFFFF; + font-size: 18px; + + height: 48px; + width: 20%; + background-color: #FF5A5F; + border-style: none; + border-radius: 4px; + + float: right; + margin-top: 11px; + margin-bottom: 11px; + margin-right: 30px; +} + +button:hover { + opacity: 90%; +} diff --git a/web_flask/static/styles/103-footer.css b/web_flask/static/styles/103-footer.css new file mode 100644 index 000000000000..11c938cd5021 --- /dev/null +++ b/web_flask/static/styles/103-footer.css @@ -0,0 +1,10 @@ +footer { + position: fixed; + bottom: 0; + background-color: white; + height: 60px; + width: 100%; + text-align: center; + line-height: 30px; + border-top: 1px solid #CCCCCC; +} diff --git a/web_flask/static/styles/103-header.css b/web_flask/static/styles/103-header.css new file mode 100644 index 000000000000..6684b08ded6f --- /dev/null +++ b/web_flask/static/styles/103-header.css @@ -0,0 +1,18 @@ +header { + background-color: white; + height: 70px; + width: 100%; + + border-bottom: 1px solid #CCCCCC; +} + +#header_logo { + height: 100%; + width: 142px; + + background-image: url("../images/logo.png"); + background-repeat: no-repeat; + background-position: center; + + margin-left: 20px; +} diff --git a/web_flask/static/styles/103-places.css b/web_flask/static/styles/103-places.css new file mode 100644 index 000000000000..14accab9bbd6 --- /dev/null +++ b/web_flask/static/styles/103-places.css @@ -0,0 +1,209 @@ +.places { + display: flex; + justify-content: center; + flex-wrap: wrap; + margin: 45px auto; + text-align: center; +} + +article { + display: flex; + width: 390px; + flex: none; + flex-wrap: wrap; + flex-direction: row; + align-content: flex-start; + + padding-top: 10px; + padding-right: 20px; + padding-left: 20px; + padding-bottom: 40px; + margin: 20px; + + border: 1px solid #FF5A5F; + border-radius: 4px; +} + +.headline { + display: flex; + flex-direction: row; + position: relative; + + height: 80px; + width: 100%; +} + +.price_by_night { + display: flex; + justify-content: center; + align-self: flex-end; + + position: absolute; + right: 0; + + line-height: 60px; + color: #FF5A5F; + font-size: 30px; + padding: 5px; + border: 4px solid #FF5A5F; + border-radius: 100%; + float: right; + min-width: 60px; + height: 60px; +} + +.information { + display: block; + height: 80px; + width: 100%; + border-top: 1px solid #DDDDDD; + border-bottom: 1px solid #DDDDDD; + + padding-top: 5px; + padding-bottom: 12px; + margin-top: 10px; + margin-bottom: 20px; +} + +.max_guest, .number_rooms, .number_bathrooms { + display: inline-block; + width: 100px; + text-align: center; + margin: 0px auto; +} + +.user { + margin-top: 5px; + margin-bottom: 5px; +} + +.description { + text-align: left; +} + +h1 { + display: block; + text-align: left; + width: 95%; + display: block; + margin-top: 0px; + margin-left: 20px; + margin-bottom: 5px; + font-size: 30px; +} + +article .amenities { + display: flex; + flex-wrap: wrap; + width: 100%; + margin-top: 40px; +} + +.article_subtitle { + font-size: 16px; + text-align: left; + width: 100%; + border-bottom: 1px solid #DDDDDD; + padding: 0px; + margin: 0px; + padding-bottom: 10px; +} + +.article_title { + font-size: 30px; + margin: 10px auto; + padding: 0px; +} + +article ul { + text-align: left; + margin-top: 20px; + margin-bottom: 0px; + padding-bottom: 0px; +} + +article li { + display: flex; + flex-direction: row; + justify-content: flex-start; + align-content: flex-start; + margin-bottom: 10px; +} + +.reviews { + margin-top: 40px; + width: 100%; +} + +.review_item { + margin-bottom: 10px; +} + +.review_text { + margin: 0px; +} + +article h3 { + font-size: 14px; + padding: 0px; + margin: 0px; + margin-bottom: 5px; + +} + +.guest_icon { + display: inline-block; + background-image: url("../images/icon_group.png"); + background-repeat: no-repeat; + background-position: center; + width: 50px; + height: 50px; +} + +.bed_icon { + display: inline-block; + background-image: url("../images/icon_bed.png"); + background-repeat: no-repeat; + background-position: center; + width: 50px; + height: 50px; +} + +.bath_icon { + display: inline-block; + background-image: url("../images/icon_bath.png"); + background-repeat: no-repeat; + background-position: center; + width: 50px; + height: 50px; +} + +.tv_icon { + display: inline-block; + background-image: url("../images/icon_tv.png"); + background-size: cover; + width: 20px; + height: 20px; + + margin-right: 10px; +} + +.wifi_icon { + display: inline-block; + background-image: url("../images/icon_wifi.png"); + background-size: cover; + width: 20px; + height: 20px; + + margin-right: 10px; +} + +.pet_icon { + display: inline-block; + background-image: url("../images/icon_pets.png"); + background-size: cover; + width: 20px; + height: 20px; + + margin-right: 10px; +} diff --git a/web_flask/static/styles/3-footer.css b/web_flask/static/styles/3-footer.css new file mode 100644 index 000000000000..11c938cd5021 --- /dev/null +++ b/web_flask/static/styles/3-footer.css @@ -0,0 +1,10 @@ +footer { + position: fixed; + bottom: 0; + background-color: white; + height: 60px; + width: 100%; + text-align: center; + line-height: 30px; + border-top: 1px solid #CCCCCC; +} diff --git a/web_flask/static/styles/3-header.css b/web_flask/static/styles/3-header.css new file mode 100644 index 000000000000..6684b08ded6f --- /dev/null +++ b/web_flask/static/styles/3-header.css @@ -0,0 +1,18 @@ +header { + background-color: white; + height: 70px; + width: 100%; + + border-bottom: 1px solid #CCCCCC; +} + +#header_logo { + height: 100%; + width: 142px; + + background-image: url("../images/logo.png"); + background-repeat: no-repeat; + background-position: center; + + margin-left: 20px; +} diff --git a/web_flask/static/styles/4-common.css b/web_flask/static/styles/4-common.css new file mode 100644 index 000000000000..cd9f953ee6ae --- /dev/null +++ b/web_flask/static/styles/4-common.css @@ -0,0 +1,13 @@ +body { + margin:0px; + padding:0px; + + color: #484848; + font-size: 14px; + font-family: Circular,"Helvetica Neue",Helvetica,Arial,sans-serif; +} + +.container { + max-width: 1000px; + margin: 30px auto; +} diff --git a/web_flask/static/styles/6-filters.css b/web_flask/static/styles/6-filters.css new file mode 100644 index 000000000000..b0cd71d7ec70 --- /dev/null +++ b/web_flask/static/styles/6-filters.css @@ -0,0 +1,103 @@ +.filters { + display: block; + background-color: white; + height: 70px; + width: 100%; + border: 1px solid #DDDDDD; + border-radius: 4px; +} + +.locations { + display: inline; + vertical-align: middle; + float: left; + height: 100%; + width: 25%; + + line-height: 20px; + border-right: 1px solid #DDDDDD; +} + +.filter_amenities { + display: inline; + vertical-align: middle; + height: 100%; + float: left; + width: 25%; + + line-height: 20px; +} + +.popover { + list-style-type: none; + display: none; + background-color: #FAFAFA; + width: 100%; + max-height: 300; + overflow-y: scroll; + + margin-left: -1px; + margin-top: 8px; + padding: 25px 0px; + + border: 1px solid #DDDDDD; + border-radius: 4px; +} + +.locations:hover .popover { + display: inline-block; +} + +.filter_amenities:hover .popover { + display: inline-block; +} + +ul { + list-style-type: none; + padding: 0px; + padding-bottom: 20px; +} + +li { +} + +h2 { + font-size: 16px; + padding-left: 30px; + margin: 0px; +} + +h3 { + font-weight: 600; + margin-top: 12px; + margin-bottom: 5px; + padding-left: 45px; +} + +h4 { + font-size: 14px; + font-weight: 400; + margin-top: 5px; + margin-bottom: 5px; + padding-left: 45px; +} + +button { + color: #FFFFFF; + font-size: 18px; + + height: 48px; + width: 20%; + background-color: #FF5A5F; + border-style: none; + border-radius: 4px; + + float: right; + margin-top: 11px; + margin-bottom: 11px; + margin-right: 30px; +} + +button:hover { + opacity: 90%; +} diff --git a/web_flask/templates/10-hbnb_filters.html b/web_flask/templates/10-hbnb_filters.html new file mode 100644 index 000000000000..14aec0774f39 --- /dev/null +++ b/web_flask/templates/10-hbnb_filters.html @@ -0,0 +1,49 @@ + + + + + AirBnB clone + + + + + + + + +
+
+
+
+

States

+

 

+
+
    + {% for state in states.values()|sort(attribute="name") %} +
  • {{ state.name }} +
      + {% for city in state.cities|sort(attribute="name") %} +
    • {{ city.name }}
    • + {% endfor %} +
    +
  • + {% endfor %} +
+
+
+

Amenities

+

 

+
    + {% for amenity in amenities.values()|sort(attribute="name") %} +
  • {{ amenity.name }}
  • + {% endfor %} +
+
+ +
+
+
+ Holberton School +
+ + diff --git a/web_flask/templates/100-hbnb.html b/web_flask/templates/100-hbnb.html new file mode 100644 index 000000000000..43d9801e9203 --- /dev/null +++ b/web_flask/templates/100-hbnb.html @@ -0,0 +1,102 @@ + + + + + + HBnB + + + + + + + + + +
+
+
+ +
+

Places

+ {% for place in places.values()|sort(attribute="name") %} +
+
+

{{ place.name }}

+
${{ place.price_by_night }}
+
+
+
+ +
{{ place.max_guest }} Guests +
+
+ +
{{ place.number_rooms }} Rooms +
+
+ +
{{ place.number_bathrooms }} Bathrooms +
+
+
+ Owner: {{ place.user.first_name }} {{ place.user.last_name }} +
+
{{ place.description|safe }}
+
+

Amenities

+ {% for amenity in place.amenities|sort(attribute="name") %} +
    +
  • {{ amenity.name }}

  • +
+ {% endfor %} +
+
+

{{ place.reviews.__len__() }} Reviews

+ {% for review in place.reviews %} +

From {{ review.user.first_name }} the {{ review.created_at.date().__str__() }}

+
    +
  • {{ review.text|safe }}

  • +
+ {% endfor %} +
+
+ {% endfor %} +
+
+
+
+ Holberton School +
+ + diff --git a/web_flask/templates/5-number.html b/web_flask/templates/5-number.html new file mode 100644 index 000000000000..e10aa1fcf809 --- /dev/null +++ b/web_flask/templates/5-number.html @@ -0,0 +1,9 @@ + + + + HBNB + + +

Number: {{ n }}

+ + diff --git a/web_flask/templates/6-number_odd_or_even.html b/web_flask/templates/6-number_odd_or_even.html new file mode 100644 index 000000000000..c8f2ae751ff2 --- /dev/null +++ b/web_flask/templates/6-number_odd_or_even.html @@ -0,0 +1,13 @@ + + + + HBNB + + + {% if n is even %} +

Number: {{ n }} is even

+ {% else %} +

Number: {{ n }} is odd

+ {% endif %} + + diff --git a/web_flask/templates/7-states_list.html b/web_flask/templates/7-states_list.html new file mode 100644 index 000000000000..46f192df5b29 --- /dev/null +++ b/web_flask/templates/7-states_list.html @@ -0,0 +1,14 @@ + + + + HBNB + + +

States

+
    + {% for state in states.values()|sort(attribute="name") %} +
  • {{ state.id }}: {{ state.name }}
  • + {% endfor %} +
+ + diff --git a/web_flask/templates/8-cities_by_states.html b/web_flask/templates/8-cities_by_states.html new file mode 100644 index 000000000000..e3b5d742bf36 --- /dev/null +++ b/web_flask/templates/8-cities_by_states.html @@ -0,0 +1,20 @@ + + + + HBNB + + +

States

+
    + {% for state in states.values()|sort(attribute="name") %} +
  • {{ state.id }}: {{ state.name }} +
      + {% for city in state.cities|sort(attribute="name") %} +
    • {{ city.id }}: {{ city.name }}
    • + {% endfor %} +
    +
  • + {% endfor %} +
+ + diff --git a/web_flask/templates/9-states.html b/web_flask/templates/9-states.html new file mode 100644 index 000000000000..16bd88c19bd2 --- /dev/null +++ b/web_flask/templates/9-states.html @@ -0,0 +1,26 @@ + + + + HBNB + + + {% if state is mapping %} +

States

+
    + {% for s in state.values()|sort(attribute="name") %} +
  • {{ s.id }}: {{ s.name }}
  • + {% endfor %} +
+ {% elif state is defined %} +

State: {{ state.name }}

+

Cities:

+
    + {% for city in state.cities|sort(attribute="name") %} +
  • {{ city.id }}: {{ city.name }}
  • + {% endfor %} +
+ {% else %} +

Not found!

+ {% endif %} + +