Tool | Description |
---|---|
Flask | Web development, one drop at a time |
Gunicorn | Python WSGI HTTP Server for UNIX |
psycopg2 | Python-PostgreSQL Database Adapter for Python |
Beautiful Soup | Python library for pulling data out of HTML and XML files |
requests | HTTP for Humans |
Flask-Babel | Implements i18n and l10n support for Flask |
Simple web application and SEO tool that scrapes h1, title and description tags for the desired website. Backend is written in Python using Flask for routing, psycopg2 for PostgreSQL database management, Beautiful Soup and requests for HTML parsing. Flask-Babel is used for adding Russian translation. Database and final project are deployed using render. Frontend relies on Bootstrap 5.0 and jinja2 templating engine. Database is reset on every server restart.
- Python >=3.7.10
- pip >=19.0
- poetry >=1.2.0
- PostgreSQL database for local deploy
To reuse this code, a PostgreSQL database server is needed.
git clone https://github.com/tmvfb/flask-webpage-analyzer.git
cd flask-webpage-analyzer
make install
to build dependenciessh setup.sh
to configure environment variables. You will be prompted to enter your database URL
Successful configuration can be started using either make dev
(Flask dev server) or make start
(gunicorn production server).
Made as a project for hexlet.io python course.
Update localization files:
pybabel extract -F babel.cfg -o messages.pot .
pybabel update -i messages.pot -d translations
- Complete the corresponding messsages.po file
pybabel compile -d translations
flask --app page_analyzer:app run --extra-files translations/{LANGUAGE}/LC_MESSAGES/messages.mo
to update localization files. Server restart works as well
New translations can be added using following commands:
pybabel extract -F babel.cfg -o messages.pot .
pybabel init -i messages.pot -d translations -l {LANGUAGE}
(insert 2-digit country code instead of {LANGUAGE})- Complete the corresponding messsages.po file
pybabel compile -d translations
flask --app page_analyzer:app run --extra-files translations/{LANGUAGE}/LC_MESSAGES/messages.mo
to update localization files. Server restart works as well