116 |
├── flask_final ├── logs │ ├── kbd.log │ ├── flask_app.log │ └── newslet │ │ ├── extractors.log │ │ └── kantipur.log ├── main │ ├── __init__.py │ └── routes.py ├── users │ ├── __init__.py │ ├── models.py │ ├── forms.py │ └── routes.py ├── newslet │ ├── __init__.py │ ├── rss_news.py │ ├── nagarik_international.py │ ├── kantipur_daily.py │ ├── kantipur_international.py │ ├── top_international_news.py │ ├── kathmandupost.py │ ├── models.py │ ├── news_loader.py │ └── routes.py ├── static │ ├── images │ │ ├── icon.jpg │ │ ├── lake.jpg │ │ ├── papers.jpeg │ │ ├── tools.jpeg │ │ ├── dashboard.jpg │ │ └── news_sources.jpeg │ ├── home │ │ └── home.css │ └── dashboard │ │ └── dashboard.css ├── __init__.py ├── templates │ ├── about.html │ ├── reset_request.html │ ├── reset_password.html │ ├── login.html │ ├── layout.html │ ├── detail_news.html │ ├── home.html │ ├── privacy_policy.html │ ├── signup.html │ ├── reset_password_email.html │ └── dashboard.html └── config.py ├── Procfile ├── migrations ├── README ├── script.py.mako ├── alembic.ini ├── env.py └── versions │ └── f682ccb0c931_.py ├── .gitattributes ├── Makefile ├── .gitignore ├── template_secrets.json ├── Dockerfile ├── run.py ├── manage.py ├── docs ├── venv.md └── postgres_setup.md ├── LICENSE ├── pyproject.toml ├── README.md └── requirements.txt /flask_final/logs/kbd.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /flask_final/main/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /flask_final/logs/flask_app.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /flask_final/users/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: gunicorn run:app 2 | -------------------------------------------------------------------------------- /flask_final/logs/newslet/extractors.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /migrations/README: -------------------------------------------------------------------------------- 1 | Generic single-database configuration. -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * linguist-vendored 2 | *.py linguist-vendored=false -------------------------------------------------------------------------------- /flask_final/newslet/__init__.py: -------------------------------------------------------------------------------- 1 | # parser = 'lxml' 2 | parser = "html.parser" 3 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | dev: 2 | .venv/bin/python manage.py db upgrade 3 | .venv/bin/python run.py debug 4 | -------------------------------------------------------------------------------- /flask_final/static/images/icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hemanta212/Nepali-news-portal-kbd/HEAD/flask_final/static/images/icon.jpg -------------------------------------------------------------------------------- /flask_final/static/images/lake.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hemanta212/Nepali-news-portal-kbd/HEAD/flask_final/static/images/lake.jpg -------------------------------------------------------------------------------- /flask_final/static/images/papers.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hemanta212/Nepali-news-portal-kbd/HEAD/flask_final/static/images/papers.jpeg -------------------------------------------------------------------------------- /flask_final/static/images/tools.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hemanta212/Nepali-news-portal-kbd/HEAD/flask_final/static/images/tools.jpeg -------------------------------------------------------------------------------- /flask_final/static/images/dashboard.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hemanta212/Nepali-news-portal-kbd/HEAD/flask_final/static/images/dashboard.jpg -------------------------------------------------------------------------------- /flask_final/static/images/news_sources.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hemanta212/Nepali-news-portal-kbd/HEAD/flask_final/static/images/news_sources.jpeg -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__/ 2 | *venv/ 3 | /.vscode/ 4 | *.pyc 5 | *.vim 6 | *.swp 7 | *.swo 8 | *.swn 9 | *.lock 10 | *.orig 11 | secrets* 12 | *.db 13 | *.env 14 | -------------------------------------------------------------------------------- /flask_final/logs/newslet/kantipur.log: -------------------------------------------------------------------------------- 1 | titles:2019/03/122019/03/122019/03/122019/03/122019/03/122019/03/122019/03/122019/03/122019/03/122019/03/122019/03/122019/03/122019/03/122019/03/122019/03/122019/03/12 -------------------------------------------------------------------------------- /template_secrets.json: -------------------------------------------------------------------------------- 1 | { 2 | "SECRET_KEY": "jpt strings like lskdjf;slkdfjldskfj;kldf", 3 | "SQLALCHEMY_DATABASE_URI": "sqlite:///site.db", 4 | "MAIL_USERNAME": "your email", 5 | "MAIL_PASSWORD": "your password" 6 | } 7 | -------------------------------------------------------------------------------- /migrations/script.py.mako: -------------------------------------------------------------------------------- 1 | """${message} 2 | 3 | Revision ID: ${up_revision} 4 | Revises: ${down_revision | comma,n} 5 | Create Date: ${create_date} 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | ${imports if imports else ""} 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = ${repr(up_revision)} 14 | down_revision = ${repr(down_revision)} 15 | branch_labels = ${repr(branch_labels)} 16 | depends_on = ${repr(depends_on)} 17 | 18 | 19 | def upgrade(): 20 | ${upgrades if upgrades else "pass"} 21 | 22 | 23 | def downgrade(): 24 | ${downgrades if downgrades else "pass"} 25 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.10.6-slim as python 2 | ENV PYTHONUNBUFFERED=true 3 | WORKDIR /app 4 | 5 | FROM python as poetry 6 | ENV POETRY_HOME=/opt/poetry 7 | ENV POETRY_VIRTUALENVS_IN_PROJECT=true 8 | ENV PATH="$POETRY_HOME/bin:$PATH" 9 | RUN python3 -m venv $POETRY_HOME 10 | RUN $POETRY_HOME/bin/pip install poetry==1.3.2 11 | COPY . ./ 12 | COPY template_secrets.json secrets.json 13 | RUN poetry install --only main --no-interaction --no-ansi -vvv 14 | 15 | FROM python as runtime 16 | ENV PATH="/app/.venv/bin:$PATH" 17 | COPY --from=poetry /app /app 18 | EXPOSE 5000 19 | CMD python manage.py db upgrade && python run.py debug 20 | -------------------------------------------------------------------------------- /run.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | from flask_final.config import Prod, Debug, Secrets 4 | from flask_final import create_app 5 | 6 | app = None 7 | args = sys.argv[1:] 8 | if "run:app" in args: 9 | args = sys.argv[2:] 10 | 11 | if len(args) == 0 or args[0] == "prod": 12 | app = create_app(Prod) 13 | elif args[0] == "debug": 14 | app = create_app(Debug) 15 | else: 16 | print(f"Usage: run.py [prod/debug]. Unrecognized argument {args[0]}") 17 | 18 | is_env_var_set = os.getenv("SQLALCHEMY_DATABASE_URI") 19 | if not is_env_var_set: 20 | print( 21 | ":: No environment variables set!\n" 22 | ":: Falling back to Debug Mode and reading secrets from file" 23 | ) 24 | app = create_app(Secrets()) 25 | 26 | if __name__ == "__main__": 27 | app.run('0.0.0.0') 28 | -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from flask_final.config import Debug, Secrets 4 | from flask_final import db, create_app 5 | 6 | is_env_var_set = os.getenv("SQLALCHEMY_DATABASE_URI") 7 | if not is_env_var_set: 8 | config = Secrets() 9 | else: 10 | config = Debug 11 | 12 | # Support for relative sqlite URIs 13 | if config.SQLALCHEMY_DATABASE_URI == "sqlite:///site.db": 14 | temp_app = create_app(config) 15 | config.SQLALCHEMY_DATABASE_URI = "sqlite:///" + os.path.join( 16 | temp_app.root_path, "site.db" 17 | ) 18 | 19 | app = create_app(config) 20 | 21 | from flask_script import Manager 22 | from flask_migrate import Migrate, MigrateCommand 23 | 24 | migrate = Migrate(app, db) 25 | manager = Manager(app) 26 | manager.add_command("db", MigrateCommand) 27 | 28 | if __name__ == "__main__": 29 | manager.run() 30 | -------------------------------------------------------------------------------- /flask_final/main/routes.py: -------------------------------------------------------------------------------- 1 | """ 2 | contains core routes of webapp 3 | """ 4 | 5 | from flask import render_template, redirect, Blueprint, url_for 6 | from flask_login import current_user 7 | 8 | main = Blueprint("main", __name__) 9 | 10 | 11 | @main.route("/", methods=["GET", "POST"]) 12 | def home(): 13 | # if current_user.is_authenticated: 14 | return redirect(url_for("newslet.nep_national_news")) 15 | # return redirect(url_for("newslet.eng_international_news")) 16 | 17 | 18 | @main.route("/home", methods=["GET", "POST"]) 19 | def homepage(): 20 | return render_template("home.html") 21 | 22 | 23 | @main.route("/about", methods=["GET"]) 24 | def about(): 25 | return render_template("about.html", title="About this website") 26 | 27 | 28 | @main.route("/privacy_policy", methods=["GET"]) 29 | def privacy_policy(): 30 | return render_template("privacy_policy.html", title="Privacy policy") 31 | -------------------------------------------------------------------------------- /migrations/alembic.ini: -------------------------------------------------------------------------------- 1 | # A generic, single database configuration. 2 | 3 | [alembic] 4 | # template used to generate migration files 5 | # file_template = %%(rev)s_%%(slug)s 6 | 7 | # set to 'true' to run the environment during 8 | # the 'revision' command, regardless of autogenerate 9 | # revision_environment = false 10 | 11 | 12 | # Logging configuration 13 | [loggers] 14 | keys = root,sqlalchemy,alembic 15 | 16 | [handlers] 17 | keys = console 18 | 19 | [formatters] 20 | keys = generic 21 | 22 | [logger_root] 23 | level = WARN 24 | handlers = console 25 | qualname = 26 | 27 | [logger_sqlalchemy] 28 | level = WARN 29 | handlers = 30 | qualname = sqlalchemy.engine 31 | 32 | [logger_alembic] 33 | level = INFO 34 | handlers = 35 | qualname = alembic 36 | 37 | [handler_console] 38 | class = StreamHandler 39 | args = (sys.stderr,) 40 | level = NOTSET 41 | formatter = generic 42 | 43 | [formatter_generic] 44 | format = %(levelname)-5.5s [%(name)s] %(message)s 45 | datefmt = %H:%M:%S 46 | -------------------------------------------------------------------------------- /docs/venv.md: -------------------------------------------------------------------------------- 1 | ### Setting up a Virtual Environment 2 | Venv is provided with the default installation of python since python 3.4 and above. 3 | 4 | * Make a virtual environment: 5 | ``` 6 | python -m venv venv 7 | ``` 8 | 9 | * Activate it 10 | 11 | - For Windows: 12 | ``` 13 | venv\Scripts\activate 14 | ``` 15 | 16 | - For Linux/Mac/(other Unix): 17 | ``` 18 | source venv/bin/activate 19 | ``` 20 | 21 | Once activated you can use regular python and pip commands and it will operate under your local project. 22 | 23 | You can verify this by running 24 | ``` 25 | $ where python # for Windows 26 | $ which pip python # for others 27 | ``` 28 | 29 | NOTE: This applies to not only pip and python but also other python scripts like black, pylint, etc 30 | 31 | After finishing your work you can simply use the ```deactivate``` command to deactivate your virtual environment and use the system's version of pip and python. 32 | 33 | Similarly closing the current terminal window also deactivates it. 34 | 35 | 36 | -------------------------------------------------------------------------------- /flask_final/static/home/home.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | width: 100%; 4 | height: 100%; 5 | } 6 | 7 | nav { 8 | padding-bottom: 2%; 9 | } 10 | 11 | #nav1 ul { 12 | text-align: right; 13 | margin-left: 70%; 14 | } 15 | 16 | #nav1 ul a { 17 | margin-left: 16px; 18 | } 19 | 20 | ul a:hover { 21 | border-bottom: 2px solid black; 22 | } 23 | 24 | #intro { 25 | padding: 14% 0; 26 | background-size: cover; 27 | height: 100%; 28 | margin-top: 3%; 29 | } 30 | 31 | #get { 32 | background: #bab9b9; 33 | } 34 | 35 | #id1 { 36 | background-size: cover; 37 | background: url(images/bg.jpg); 38 | } 39 | 40 | #row1 { 41 | color: white; 42 | } 43 | 44 | #content { 45 | color: black; 46 | } 47 | 48 | .social a { 49 | margin: 17px; 50 | 51 | } 52 | 53 | footer { 54 | color: white; 55 | background: black; 56 | margin-top: -2%; 57 | } 58 | 59 | #ft1, 60 | #ft2 { 61 | margin-top: 2%; 62 | } 63 | 64 | .text-overlay { 65 | color: black; 66 | } 67 | 68 | .get-started { 69 | color: white; 70 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Hemanta Sharma 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /flask_final/__init__.py: -------------------------------------------------------------------------------- 1 | # -*-code: UTF-8 2 | """ 3 | Initialization module of projects that initializes 4 | app, db, Kbdlog,bcrypt, login_manager, mail, Config 5 | 6 | """ 7 | import json 8 | import os 9 | 10 | from flask import Flask 11 | from flask_sqlalchemy import SQLAlchemy 12 | from flask_bcrypt import Bcrypt 13 | from flask_login import LoginManager 14 | from flask_mail import Mail 15 | 16 | bcrypt = Bcrypt() 17 | login_manager = LoginManager() 18 | login_manager.login_view = "users.login" 19 | login_manager.login_message_category = "info" 20 | db = SQLAlchemy() 21 | mail = Mail() 22 | NEWS_API_KEY = os.getenv("NEWS_API_KEY") 23 | 24 | 25 | def create_app(config): 26 | app = Flask(__name__.split('.')[0]) 27 | app.config.from_object(config) 28 | 29 | db.init_app(app) 30 | bcrypt.init_app(app) 31 | login_manager.init_app(app) 32 | mail.init_app(app) 33 | 34 | from flask_final.users.routes import users 35 | from flask_final.newslet.routes import newslet 36 | from flask_final.main.routes import main 37 | 38 | app.register_blueprint(users) 39 | app.register_blueprint(newslet) 40 | app.register_blueprint(main) 41 | 42 | return app 43 | -------------------------------------------------------------------------------- /flask_final/templates/about.html: -------------------------------------------------------------------------------- 1 | {%extends 'dashboard.html'%} 2 | 3 | {%block content%} 4 | 5 |
14 | This website is built as the pet project of mine. On the journey to learn backend web-development, I decided to 15 | make something of my own interest to practice my skills. 16 |
17 | 18 |19 | Khabar-board currently featured extracted summary news from various news portals of Nepal. Similarly, We will 20 | soon incorporate news from top international sites as well. Similarly, handy tools like conversion tools, 21 | weather and other facilities are also on the way. 22 |
23 | 24 |27 | I am also planning to include push notificatiion and newsletters in the future. 28 |
29 | 30 |Latest, important and summarized national and international news right on your finger Tips.
40 |We bring you news from reputed and established national and international news agencies. Our default news sources comprise BBC, CNN, The himalayan times, and Kantipur.
58 |Pick your own topics, sources to filter your interest. Get live score updates of your favorite sports. Get updates about film releases, shows. So what are you waiting for?
76 |We bring you small handy tools like weather reports, conversion tools, calendar etc.
95 |Khabarboard operates the https://kbd.herokuapp.com website, which provides the SERVICE.
8 |This page is used to inform website visitors regarding our policies with the collection, use, and disclosure of Personal Information if anyone decided to use our Service, the khabarboard website.
9 |If you choose to use our Service, then you agree to the collection and use of information in relation with this policy. The Personal Information that we collect are used for providing and improving the Service. We will not use or share your information with anyone except as described in this Privacy Policy.
10 |The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at https://kbd.herokuapp.com, unless otherwise defined in this Privacy Policy. 11 |
For a better experience while using our Service, we may require you to provide us with certain personally identifiable information, including but not limited to your name, phone number, and postal address. The information that we collect will be used to contact or identify you.
13 |We want to inform you that whenever you visit our Service, we collect information that your browser sends to us that is called Log Data. This Log Data may include information such as your computer’s Internet Protocol ("IP") address, browser version, pages of our Service that you visit, the time and date of your visit, the time spent on those pages, and other statistics.
15 |Cookies are files with small amount of data that is commonly used an anonymous unique identifier. These are sent to your browser from the website that you visit and are stored on your computer’s hard drive.
17 |Our website uses these "cookies" to collection information and to improve our Service. You have the option to either accept or refuse these cookies, and know when a cookie is being sent to your computer. If you choose to refuse our cookies, you may not be able to use some portions of our Service.
18 |We may employ third-party companies and individuals due to the following reasons:
20 |We want to inform our Service users that these third parties have access to your Personal Information. The reason is to perform the tasks assigned to them on our behalf. However, they are obligated not to disclose or use the information for any other purpose.
27 |We value your trust in providing us your Personal Information, thus we are striving to use commercially acceptable means of protecting it. But remember that no method of transmission over the internet, or method of electronic storage is 100% secure and reliable, and we cannot guarantee its absolute security.
29 |Our Service may contain links to other sites. If you click on a third-party link, you will be directed to that site. Note that these external sites are not operated by us. Therefore, we strongly advise you to review the Privacy Policy of these websites. We have no control over, and assume no responsibility for the content, privacy policies, or practices of any third-party sites or services.
31 |Children’s Privacy
32 |Our Services do not address anyone under the age of 13. We do not knowingly collect personal identifiable information from children under 13. In the case we discover that a child under 13 has provided us with personal information, we immediately delete this from our servers. If you are a parent or guardian and you are aware that your child has provided us with personal information, please contact us so that we will be able to do necessary actions.
33 |We may update our Privacy Policy from time to time. Thus, we advise you to review this page periodically for any changes. We will notify you of any changes by posting the new Privacy Policy on this page. These changes are effective immediately, after they are posted on this page.
35 |If you have any questions or suggestions about our Privacy Policy, do not hesitate to contact us.
37 | 38 |
24 |
|
98 |