This minimal Flask project shows a simple page in two different versions:
- single language;
- two languages.
This is not a training ab initio. It's a fast note just to remember how to do it. So, to understand this project you need to know:
- what is a web site, a programming language, a development framework;
- a basic knowledge of Python, html, http;
- what is a virtual environment about Python;
- console commands in the operating system of your development personal computer;
- how works a template system, specifically Jinja.
To make our project, we are going to use Flask's blueprint(s): one blueprint to show the single language html page. The other to show the double languages html page.
Each blueprint is an app, and our site (an application) will be formed by these two apps.
Base environments:
In cmd:
>git clone https://github.com/l-dfa/flask_single_page.git >cd flask_single_page >python -m venv venv # install python's virtual environment in flask_single_page/venv ... >venv\Scripts\activate # ... and activate it (venv) >python -m pip install -U pip # upgrade pip (venv) >pip install flask # install flask in virtual env. (venv) >pip install Flask-Babel # install flask-babel in virtual env. (venv) >pip install flask-sitemap # install flask-sitemap in virtual env. (venv) >python run.py
@ these links:
- how show a page with single language;
- how show a page with two languages;
- managing the URLs;
- creating a sitemap.xml;
- instance folder and log;
- adding unit tests;
- playing AJAX.