From 8f4c620486634c1706b0bbbf4fbd66368f6e6930 Mon Sep 17 00:00:00 2001 From: Ayan Hazra <69693282+jesus7110@users.noreply.github.com> Date: Thu, 30 Sep 2021 23:48:52 +0530 Subject: [PATCH 01/16] Update README.md Added lines for how to run the app --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 7f92142..66b58e8 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,14 @@
![alt text](https://github.com/kavyanshpandey/python-flask-blog/blob/master/pic1.png) + +
+
+### How to Run. + > Clone this repo + > Install dependepcies + > Run "app.py" + + +
+
From 09137ca3d37025f393fda97ea929f18f2a74674a Mon Sep 17 00:00:00 2001 From: Ayan Hazra <69693282+jesus7110@users.noreply.github.com> Date: Thu, 30 Sep 2021 23:52:25 +0530 Subject: [PATCH 02/16] Update README.md --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 66b58e8..b98beb1 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,10 @@

### How to Run. - > Clone this repo - > Install dependepcies - > Run "app.py" + + -> Clone this repo + -> Install dependepcies + -> Run "app.py"
From 5df15b7725ff10f3d188a43f6149c0e565b7f87b Mon Sep 17 00:00:00 2001 From: Shruti Nanda <57368869+Saggittarius-A@users.noreply.github.com> Date: Fri, 1 Oct 2021 00:24:58 +0530 Subject: [PATCH 03/16] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7f92142..dff7fff 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # python-flask-Web-APP -### This is a web application made with python-Flask, and SQLLITE3 used as backend. +### This is a Web Application made with python-Flask, and SQLLITE3 used as backend. ### Project View. From 99834d9d87ae3f6e732769b78c071473815f46db Mon Sep 17 00:00:00 2001 From: topperkp <72164673+topperkp@users.noreply.github.com> Date: Fri, 1 Oct 2021 00:33:22 +0530 Subject: [PATCH 04/16] Added comments on Readme.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 7f92142..f966bc4 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,10 @@ ### Project View. +## Use Cases +1. User can add any number of blogpost +2. User can also delete posts by clicking on red button. +

From ce672772decc483d1e1f82eb3fa8f6a27d901634 Mon Sep 17 00:00:00 2001 From: Akhil Soni <58397226+akhil-maker@users.noreply.github.com> Date: Fri, 1 Oct 2021 00:55:20 +0530 Subject: [PATCH 05/16] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f966bc4..96117c1 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ ### This is a web application made with python-Flask, and SQLLITE3 used as backend. -### Project View. +### Project View ## Use Cases -1. User can add any number of blogpost +1. User can add any number of blogpost. 2. User can also delete posts by clicking on red button.
From 0e9ddaa730b89eb406eb580e8dd55f7ee88fe2ed Mon Sep 17 00:00:00 2001 From: bhattji007 <53906268+bhattji007@users.noreply.github.com> Date: Sat, 2 Oct 2021 10:16:31 +0530 Subject: [PATCH 06/16] Update contact.html --- templates/contact.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/templates/contact.html b/templates/contact.html index 7974ea1..c3c4674 100644 --- a/templates/contact.html +++ b/templates/contact.html @@ -28,8 +28,13 @@

You can connect with me

twitter »

+

Connect with me on linkedin.

+

+ LinkedIn + » +

-{% endblock %} \ No newline at end of file +{% endblock %} From 9558191aa08e72638bf2db2d3cf00c608fa9e699 Mon Sep 17 00:00:00 2001 From: sangeeta874 <59887850+sangeeta874@users.noreply.github.com> Date: Sat, 2 Oct 2021 15:17:37 +0530 Subject: [PATCH 07/16] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ce75631..b0a44f9 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ ## Use Cases 1. User can add any number of blogpost. -2. User can also delete posts by clicking on red button. +2. User an also edit their blog +3. User can also delete posts by clicking on red button.

From 1c05b05c2b9c17c384ca64b6ca89fcf743dc5cfe Mon Sep 17 00:00:00 2001 From: Shubham Yadav Date: Tue, 5 Oct 2021 13:46:20 +0530 Subject: [PATCH 08/16] Updated readme.md added new lines --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b0a44f9..20f0de3 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,8 @@
### How to Run. - -> Clone this repo - -> Install dependepcies + -> Clone this repo + -> Install dependepcies -> Run "app.py" From 20f0a67551b9cb0f75e406e0002340f1fdaee869 Mon Sep 17 00:00:00 2001 From: Shubham Yadav <91874078+intangible-explorer@users.noreply.github.com> Date: Tue, 5 Oct 2021 13:49:17 +0530 Subject: [PATCH 09/16] Updated gitignore file --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ede80b8..2be620c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ # created by virtualenv automatically * +bin/ From 6ad0547b7b0fe012c5ad7734e400a0bbde779abe Mon Sep 17 00:00:00 2001 From: sujoy-coder Date: Wed, 6 Oct 2021 00:42:57 +0530 Subject: [PATCH 10/16] added about-us page in blog site --- app.py | 4 ++++ templates/base.html | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 015cfa9..e2edf37 100644 --- a/app.py +++ b/app.py @@ -34,6 +34,10 @@ def __repr__(self): def homepage(): return render_template('index.html') +@app.route('/aboutus', methods =['GET']) +def aboutpage(): + return render_template('about.html') + @app.route('/contactus', methods=['GET']) def contact(): return render_template('contact.html') diff --git a/templates/base.html b/templates/base.html index b6cfa00..84d727b 100644 --- a/templates/base.html +++ b/templates/base.html @@ -24,7 +24,10 @@ All posts + From 8de990de0c9a2a31c758572a26ee1b3bc7671b38 Mon Sep 17 00:00:00 2001 From: sujoy-coder Date: Wed, 6 Oct 2021 00:46:16 +0530 Subject: [PATCH 11/16] added about.html --- posts.db | 0 templates/about.html | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 posts.db create mode 100644 templates/about.html diff --git a/posts.db b/posts.db new file mode 100644 index 0000000..e69de29 diff --git a/templates/about.html b/templates/about.html new file mode 100644 index 0000000..238727b --- /dev/null +++ b/templates/about.html @@ -0,0 +1,28 @@ +{% extends 'base.html' %} + + +{% block head %} +About | Python Warrior + +{% endblock %} + + +{% block body %} +

About Us

+ +
+ +
+
+

Welcome to My Blog..

+

Author : kavyansh

+
+

Hello I am Kavyansh.

+

Welcome to my blog. Here I post my thoughts like my experience in colleges and now in corporate. I also post technical contents there.

+
+ Back +
+
+
+ +{% endblock %} \ No newline at end of file From 9b8110e7a64afbdc2e04fa92318e231324374eec Mon Sep 17 00:00:00 2001 From: Joyal Shah <63547847+joyal7701@users.noreply.github.com> Date: Wed, 6 Oct 2021 20:26:46 +0530 Subject: [PATCH 12/16] Update main.css --- static/css/main.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/static/css/main.css b/static/css/main.css index 4192a4e..477f887 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -10,4 +10,5 @@ body { padding: 1rem; margin: 2rem auto; max-width: 40rem; -} */ \ No newline at end of file + background-color: red; +} */ From 2ef3af2cd23ce8b35f481a712d47d28762fa5572 Mon Sep 17 00:00:00 2001 From: jatinsajwan3841 <58560850+jatinsajwan3841@users.noreply.github.com> Date: Sun, 10 Oct 2021 01:31:08 +0530 Subject: [PATCH 13/16] naming convention for constant PORT number --- app.py | 63 ++++++++++++++++++++++++++++++---------------------------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/app.py b/app.py index e2edf37..d35fba1 100644 --- a/app.py +++ b/app.py @@ -1,4 +1,4 @@ -from flask import Flask,jsonify, render_template, request,redirect +from flask import Flask, jsonify, render_template, request, redirect from flask_sqlalchemy import SQLAlchemy from datetime import datetime @@ -7,44 +7,51 @@ app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///posts.db' db = SQLAlchemy(app) + class BlogPost(db.Model): id = db.Column(db.Integer, primary_key=True) - title = db.Column(db.String(100), nullable = False) - Content = db.Column(db.Text, nullable = False) - Author = db.Column(db.String(20), nullable = False, default = 'Unknown') - date_posted = db.Column(db.DateTime, nullable = False, default= datetime.utcnow) + title = db.Column(db.String(100), nullable=False) + Content = db.Column(db.Text, nullable=False) + Author = db.Column(db.String(20), nullable=False, default='Unknown') + date_posted = db.Column(db.DateTime, nullable=False, + default=datetime.utcnow) def __repr__(self): return 'Blog post ' + str(self.id) + all_posts = [ { 'title': 'Post1', - 'Content':'This is the content of post 1', - 'Author':'kavyansh' + 'Content': 'This is the content of post 1', + 'Author': 'kavyansh' }, { 'title': 'Post2', - 'Content':'This is the content of post 2', + 'Content': 'This is the content of post 2', # 'Author': '' } ] -@app.route('/', methods =['GET']) + +@app.route('/', methods=['GET']) def homepage(): return render_template('index.html') -@app.route('/aboutus', methods =['GET']) + +@app.route('/aboutus', methods=['GET']) def aboutpage(): return render_template('about.html') + @app.route('/contactus', methods=['GET']) def contact(): - return render_template('contact.html') + return render_template('contact.html') + -@app.route('/posts/newposts', methods=['GET','POST']) +@app.route('/posts/newposts', methods=['GET', 'POST']) def addPosts(): - if request.method == 'POST': + if request.method == 'POST': post_title = request.form['title'] post_content = request.form['Content'] post_author = request.form['Author'] @@ -52,7 +59,8 @@ def addPosts(): if post_author == '': post_author = 'Unknown' - new_post = BlogPost(title=post_title, Content=post_content, Author=post_author) + new_post = BlogPost( + title=post_title, Content=post_content, Author=post_author) db.session.add(new_post) @@ -61,14 +69,12 @@ def addPosts(): return redirect('/posts') else: - return render_template('add_posts.html') - + return render_template('add_posts.html') - -@app.route('/posts',methods =['GET', 'POST']) +@app.route('/posts', methods=['GET', 'POST']) def posts(): - if request.method == 'POST': + if request.method == 'POST': post_title = request.form['title'] post_content = request.form['Content'] @@ -77,7 +83,8 @@ def posts(): if post_author == '': post_author = 'Unknown' - new_post = BlogPost(title=post_title, Content=post_content, Author=post_author) + new_post = BlogPost( + title=post_title, Content=post_content, Author=post_author) db.session.add(new_post) @@ -85,15 +92,12 @@ def posts(): return redirect('/posts') - else: all_posts = BlogPost.query.order_by(BlogPost.date_posted).all() - return render_template('posts.html', posts = all_posts) - + return render_template('posts.html', posts=all_posts) - -@app.route('/posts/delete/',methods=['GET','POST']) +@app.route('/posts/delete/', methods=['GET', 'POST']) def deletePost(id): post_id = BlogPost.query.get(id) db.session.delete(post_id) @@ -101,8 +105,7 @@ def deletePost(id): return redirect('/posts') - -@app.route('/posts/edit/', methods=['GET','POST']) +@app.route('/posts/edit/', methods=['GET', 'POST']) def editPost(id): post_id = BlogPost.query.get_or_404(id) if request.method == 'POST': @@ -114,10 +117,10 @@ def editPost(id): return redirect('/posts') - else: - return render_template('edit.html', post = post_id) + return render_template('edit.html', post=post_id) if __name__ == "__main__": - app.run(debug=True, port= 5000) \ No newline at end of file + PORT = 5000 + app.run(debug=True, port=PORT) From b08ff55d23a1465e45ae8f64ff41295decfa1a21 Mon Sep 17 00:00:00 2001 From: muskan27042001 <72308746+muskan27042001@users.noreply.github.com> Date: Mon, 3 Oct 2022 21:19:59 +0530 Subject: [PATCH 14/16] Update and rename README.md to musi4 README.md --- README.md => musi4 README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename README.md => musi4 README.md (95%) diff --git a/README.md b/musi4 README.md similarity index 95% rename from README.md rename to musi4 README.md index 20f0de3..d1d2fff 100644 --- a/README.md +++ b/musi4 README.md @@ -1,7 +1,7 @@ # python-flask-Web-APP ### This is a Web Application made with python-Flask, and SQLLITE3 used as backend. - +i am contributing:> ### Project View ## Use Cases From 2f7ba361512a827715e32912da02c8e6af706d3c Mon Sep 17 00:00:00 2001 From: Harshita1503 <55319937+Harshita1503@users.noreply.github.com> Date: Sat, 22 Oct 2022 16:38:34 +0530 Subject: [PATCH 15/16] Update index.html --- templates/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/index.html b/templates/index.html index 7e25879..308f975 100644 --- a/templates/index.html +++ b/templates/index.html @@ -19,7 +19,7 @@

Author : kavyansh


Hello I am Kavyansh.

Welcome to my blog. Here I post my thoughts like my experience in colleges and now in corporate. I also post technical contents there.

-

I have done few projects in this lockdown, You can get source_code for projects from my github profile.

+

I have done few projects in this lockdown, You can get source_code for projects from my github profile: kavyanshpandey.


@@ -30,4 +30,4 @@

Author : kavyansh

- {% endblock %} \ No newline at end of file + {% endblock %} From d41b9c101313d75894b74a23b82dfe2294c9344f Mon Sep 17 00:00:00 2001 From: kirtiRamrakhyani Date: Tue, 31 Oct 2023 22:23:37 +0530 Subject: [PATCH 16/16] My first commit --- app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index d35fba1..543f7ff 100644 --- a/app.py +++ b/app.py @@ -24,7 +24,7 @@ def __repr__(self): { 'title': 'Post1', 'Content': 'This is the content of post 1', - 'Author': 'kavyansh' + 'Author': 'Kavyansh Pandey' }, { 'title': 'Post2', @@ -120,7 +120,7 @@ def editPost(id): else: return render_template('edit.html', post=post_id) - +# Main function if __name__ == "__main__": PORT = 5000 app.run(debug=True, port=PORT)