An interactive blog. Hosted on FLASK web server
- Python, Flask module, Flask-Sqlalchemy extension
- HTML, CSS, BOOTSTRAP FRAMEWORK
- Front end is entirely, HTML codes with CSS and BOOTSTRAP as the framework.
- The About, Home, Login, Registration and LAYOUT pages were created as seperate templates, and are present in the templates folder under Flasktest.
- The 'main.css', referenced in the 'layout.html' template is present in the static folder and is the same css pattern followed by all the routes.
- 'layout.html' contains all the common HTML code for Home and About pages.
- the concept of '{% codeblocks %}' is used to integrate the templates with the 'layout.html'
- The routes are present in the 'routes.py' file programmed with Flask module in Python v3.7.
- The Login and Registration forms draw imports from 'forms.py' which contain a built in model FlaskForm. the FlaskForm extension does all the form 'Validation', minimising code end.
- 'forms.py' contains 2 classes which are imported into their respecive templates using the codeblocks.
- '__init.py' contains the Creation of the database 'site.db' and initialisation of the 'db' variable which is later imported in 'models.py'.
- The creation of the database is done with the SQLAlchemy extension of flask.
- 'models.py' is the module which creates and maintins users and posts. The system incorporated here is called "multi to one". In DB terms, 1 'user' (author) can have many 'posts' but 1 'post' can have only 1 'author'.
- Hence the 'User' class is linked to the 'Post' class usind 'db.relationship('Post',backref='author', lazy=True)' command.
- 'site.db' is the database file available locally on the host PC directories.
To run the blog on your base system, install the following modules using your CLI:
- $ pip install flask
- $ pip install datetime
- $ pip install flask-wtf
- $ pip install flask-sqlalchemy
- $ pip install wtforms
If the above CLI install's don't work, Try
$ pip install --upgrade pip
or
$ curl https://bootstrap.pypa.io/get-pip.py | python3
Prefferably, use Python3.7 since Python is stopping services for v2.7