Skip to content

hmazzas/Capybara-Blog

Repository files navigation

Blog

Key concepts:

Basic HTML and CSS (Bootstrap);

CRUD operations with SQLlite and SQL Alchemy - Relational Databases;

FlaskFramework - Basic Functionalities;

FlaskLogin - Authentication

Python Decorators

The project

Crete a mobile responsive Blog Website to host posts and comments with Authentication feature. And deploy the app on Heroku. As there is a chance that the blog will not be hosted for a long time, the basic app features are presented below.

Home Page

image The Home Page display a NaviBar with : Home, Login, Register, About, Contact Create New Post redirects you to the Forms to create a new post. The acess is retritcted to Admin Only. To that the login is necessary.

Login Page

image We have two entries of a Flask-WTForm - one for the email and the other for the password. When submitted, it will be checked against the user database. If it is a register user will have the permission to comment, if admin can create a new post too.

Create a New Post

In this section is displayed the form to create a new blog post. With a title, subtitle, img_url and body sections to fill. The data from the for is stored with SQLAlchemy after the POST request (submit button). image

Home Page displaying the new posts

image Now, when we redirect to the home page we can see the new blog post presented with it's title, subtitle and the user who post it.

Show specific blog post

image image Here we see the complete post, the edit button and the comment form. If we submit a comment:

image

Post edit

When the 'edit post' page is loaded, the forms are automatically filled with the post information to be edited. image

Authentication

If user that is not the admin and tries to edit or create a post: image

Adding more posts

image image

Using DB Browser to see the tables in the Database

image image image

We can see that the relationship between the tables and the hashing of the password is working properly. There are a few comments in the code highlighting some key structures and resources used.