From e893a09549b907bb32c638a6bfd279469b676606 Mon Sep 17 00:00:00 2001 From: Mohammad Rameen Date: Sat, 12 Apr 2025 15:37:03 +0530 Subject: [PATCH] Final Blog website --- .../Day-57/__pycache__/post.cpython-312.pyc | Bin 0 -> 589 bytes Visual Studio Code Projects/Day-57/main.py | 37 +++++++++ Visual Studio Code Projects/Day-57/post.py | 6 ++ Visual Studio Code Projects/Day-57/server.py | 35 --------- .../Day-57/static/css/styles.css | 71 ++++++++++++++++++ .../Day-57/templates/index.html | 31 +++++--- .../__pycache__/data.cpython-312.pyc | Bin 551 -> 717 bytes .../question_model.cpython-312.pyc | Bin 513 -> 556 bytes .../__pycache__/quiz_brain.cpython-312.pyc | Bin 1794 -> 1837 bytes .../__pycache__/ui.cpython-312.pyc | Bin 4518 -> 4561 bytes 10 files changed, 136 insertions(+), 44 deletions(-) create mode 100644 Visual Studio Code Projects/Day-57/__pycache__/post.cpython-312.pyc create mode 100644 Visual Studio Code Projects/Day-57/main.py create mode 100644 Visual Studio Code Projects/Day-57/post.py delete mode 100644 Visual Studio Code Projects/Day-57/server.py create mode 100644 Visual Studio Code Projects/Day-57/static/css/styles.css diff --git a/Visual Studio Code Projects/Day-57/__pycache__/post.cpython-312.pyc b/Visual Studio Code Projects/Day-57/__pycache__/post.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..913f6ed6c91d606b0e49ffea35fe673ea1ef2dbe GIT binary patch literal 589 zcmX|8Jxjw-6umEbv9%h+qR=`>)(kZ|h#s{^DQGwPg20yb;eJkxxc8L=M^ysWH-*M;KOp-gNe*cKTu9IYHQW16MkchaJwr{(j@kO;n@ZYn+DCbFO?fbO+XDJd}QD z(J$*F3U9q`tQ<5p4v!pKY41MC%0l>eek{bJNf)rUOzALc7vTw})%ut}m!{i0NR?^L zLNcdYwK0EL&CvmLI-GOo2A&XEMTj7j!vX1aAs%oiMI~BC?<+(mQnW@ucQgmONJZxz tL9TJ5UU;b7vRPr{+=lvTfzIDdfuV%3N4") +def show_post(index): + requested_post = None + for blog_post in post_objects: + if blog_post.id == index: + requested_post = blog_post + return render_template("post.html", post=requested_post) + +if __name__ == "__main__": + app.run(debug=True) + + + + + diff --git a/Visual Studio Code Projects/Day-57/post.py b/Visual Studio Code Projects/Day-57/post.py new file mode 100644 index 0000000..7e23136 --- /dev/null +++ b/Visual Studio Code Projects/Day-57/post.py @@ -0,0 +1,6 @@ +class Post: + def __init__(self, post_id, title, subtitle, body): + self.id = post_id + self.title = title + self.subtitle = subtitle + self.body = body \ No newline at end of file diff --git a/Visual Studio Code Projects/Day-57/server.py b/Visual Studio Code Projects/Day-57/server.py deleted file mode 100644 index da3213d..0000000 --- a/Visual Studio Code Projects/Day-57/server.py +++ /dev/null @@ -1,35 +0,0 @@ -from flask import Flask, render_template -import random -import datetime -import requests - -app = Flask(__name__) - - -@app.route('/') -def home(): - random_number = random.randint(1, 10) - current_year = datetime.datetime.now().year - return render_template('index.html', num=random_number, year=current_year) - -@app.route('/guess/') -def guess(name): - gender_url = f"https://api.genderize.io?name={name}" - age_url = f"https://api.agify.io?name={name}" - gender_response = requests.get(gender_url) - gender_data = gender_response.json() - gender = gender_data["gender"] - age_response = requests.get(age_url) - age_data = age_response.json() - age = age_data["age"] - return render_template('guess.html', name=name, gender=gender, age=age) - -@app.route('/blog') -def get_blog(): - blog_url = "https://api.npoint.io/c790b4d5cab58020d391" - blog_response = requests.get(blog_url) - all_posts = blog_response.json() - return render_template("blog.html", posts=all_posts) - -if __name__ == "__main__": - app.run(debug=True) \ No newline at end of file diff --git a/Visual Studio Code Projects/Day-57/static/css/styles.css b/Visual Studio Code Projects/Day-57/static/css/styles.css new file mode 100644 index 0000000..8044936 --- /dev/null +++ b/Visual Studio Code Projects/Day-57/static/css/styles.css @@ -0,0 +1,71 @@ +body{ + background: #efeff3; + margin: 0; + font-family: 'Raleway', sans-serif; + -webkit-font-smoothing: antialiased; + color:#212121; +} +.wrapper{ + position: relative; + clear:both; + margin: 0 auto 75px auto; + width: 100%; + overflow: hidden; +} +.top{ + background: #4e89ae; + height: 180px; + border-top: 20px solid #43658b; +} + +.top .title { + width: 700px; + margin: 38px auto 0 auto; +} + +.title h1 { + font-size:24px; + color:#FFF; + font-weight:500; +} + +.content{ + margin: -80px auto 100px; + padding-bottom: 20px; +} + +.card{ + position: relative; + background: #fff; + padding:50px; + width: 600px; + margin: 20px auto 0 auto; + box-shadow: 0 2px 4px rgba(100,100,100,.1); +} + +.card h2 { + font-size:21px; + font-weight:500; +} + +.card h2 a { + color:#CC0000; + text-decoration:none; +} + +.card .text { + color:#212121; + margin-top:20px; + font-size:15px; + line-height:22px; +} + +footer { + position: fixed; + left: 0; + bottom: 0; + width: 100%; + background-color: #43658b; + color: white; + text-align: center; +} \ No newline at end of file diff --git a/Visual Studio Code Projects/Day-57/templates/index.html b/Visual Studio Code Projects/Day-57/templates/index.html index f046c70..e94dd87 100644 --- a/Visual Studio Code Projects/Day-57/templates/index.html +++ b/Visual Studio Code Projects/Day-57/templates/index.html @@ -1,16 +1,29 @@ - - - My Website - + + + Title + + + -

Hello World!

-

{{ 5 * 6}}

-

Random Number: {{ num }}

-Go To Blog +
+
+

My Blog

+
+ + {% for post in all_posts: %} +
+
+

{{ post.title }}

+

{{ post.subtitle }}

+ Read +
+
+ {% endfor %} +
-

Copyright {{ year }}. Built by Mohammad.

+

Made with ♥️ in India.

\ No newline at end of file diff --git a/Visual Studio Code Projects/quizzler-app-start/__pycache__/data.cpython-312.pyc b/Visual Studio Code Projects/quizzler-app-start/__pycache__/data.cpython-312.pyc index 21d9ea89bf9126a3c4ab4025e12f677ba08443fc..ef695eaa3a0e6c1185eda36d193d03b867944bae 100644 GIT binary patch literal 717 zcmaJ23kNtNsDwZw9Ktp`O&r^MXi7Victv_lwu-O zM};apUM}p{V)02?G<=#J*R&wv{3IrVc|8q=YidFX%mPxV> z27B$^PvGW#z{!=?CCL?+1|cw(m9AGFD)MVX;OoGrXJ?oFO+Lo2VYMl)UI z(i9`JFz>eeF3!d;dEZ6bcfhX|8);?bpb|^2F1;Icxv{02nw;lCmNp*pWce|i6ORCg zGkWECjGmQ+qv^G_Q|G0x*%mFG=FuZ1y#!}z)3DI1X`5-j1ug)^ANfL8lvjEoE2(lz zM!Wpgcs%?d*KYXvdiY)|%D)w^mSz8ouT`P@oa$d%y`-6U`AuDHHYM4iG-ik)tk3zF zky)dC_q@`oF6pg(j`Q$~2zR+XI1B>51#t+7#o-gs!81Vb2#`dNJD@D(tT;FUy+)k3 raqlCp66TsId8aQRuzze8^d;eBb5S`!@FQA%i^rqjw4eZd2jm}U+KjLK z<{k(Tr4D5vA)*pQ!Vm67PJPyUF3TxB*UgoBQ-4{b8Zk0HE9*@q9~lPotzoc8>W7Tg zDYhi!RjFZ2t`Y2zxVl_O?XxWK~U64f}fBqCT~8UG8YGOH5MCm078O_mEM%%la=Il-ohNnvjX ztusRJBB87~F^VQ5PMxmVOTO2C4e)Khj8sKYz92EuATj5~7QN*BkB(+To#-eAvGm2t wb@8&;PjB{jD}$MXj^Tmv37HSb3?S?2iSt&sb=K}6FPXa8cN5*Xo$^C}0q3E4DgXcg diff --git a/Visual Studio Code Projects/quizzler-app-start/__pycache__/question_model.cpython-312.pyc b/Visual Studio Code Projects/quizzler-app-start/__pycache__/question_model.cpython-312.pyc index fc499157c6b3b2ca2e814e37b9157f371fc5e0b3..afc1b9d408a8dd37107b66904821f80b859f0277 100644 GIT binary patch delta 90 zcmZoSSHU{{UmB B5E=jg diff --git a/Visual Studio Code Projects/quizzler-app-start/__pycache__/quiz_brain.cpython-312.pyc b/Visual Studio Code Projects/quizzler-app-start/__pycache__/quiz_brain.cpython-312.pyc index 42f5076647337eb1af4695ed7c66f205d08afe73..40e68524755ee62895a78503105d438bfc37de4a 100644 GIT binary patch delta 92 zcmZqTTg%6DnwOW00SIQDYDwS7ylVm stm~hq>ztpGsvnkFT$-4p5L{B4l9{gn5>f~#%FjwoE-Bue!Z?o=06c0QaR2}S delta 49 zcmZ3>*TlzjnwOW00SI!AW~FW9abgrR)6dAyP1VmW%}C76O-#`b3wF*=N!{GfIFA(o DS8Wd- diff --git a/Visual Studio Code Projects/quizzler-app-start/__pycache__/ui.cpython-312.pyc b/Visual Studio Code Projects/quizzler-app-start/__pycache__/ui.cpython-312.pyc index 39cd90b3e7ff2cae282be0d0577d6514def18e3c..00ded14098cc95bdbb099175d3b3b482dd4776ef 100644 GIT binary patch delta 92 zcmZ3cd{LR_G%qg~0}#wQ)snuE=Q5jPq<%(zZmNE6enw($Vv2rIYC(RnzM+AEu1jKN sv95obu5*4$s(x5zacN?XLU2iGN@l(SNJt@|C_gJTxukgWSGJ8@0FTum9{>OV delta 49 zcmcbpyiA$rG%qg~0}$w*$V%JDbD2#{Pd_6+H&s8kG$S!LH!(#&EZ8|eC3Uj``$jGR Db7&8d