/tecxploit1

A Flask social blogging web application.

Primary LanguagePython

Flasky

This repository contains my code for the Flask Web Development, 2nd Edition book.

Flasky is a Flask social blogging application web application in which authenticated users can follow\unfollow each other, as well as creating and editing their own blog posts and comments.

Prerequisites:

The application was built using Python 3.7, so you should ensure you have it installed on your machine.

You can find the application requirements in the requirements folder.

Features:

  • Users registration and logging in subsystem.
  • Users profiles and avatars using the Gravatar service.
  • Users follow\unfollow subsystem.
  • Markdown support for blog posts.
  • Comments moderation.
  • Secure against Cross-Site Request Forgery (CSRF) attacks.
  • Responsive and elegant UI.
  • RESTful API endpoints.
  • Unit tests.
  • Database migrations.

Usage:

  1. Clone this repository to your desktop, go to the flasky directory and create a new virtual environment to create isolated Python environment. Note: I highly recommend using Virtualenv.

  2. Install the application requirements:

pip install -r requirements\dev.txt
  1. Create these environnement variables: Note: MAIL_USERNAME and MAIL_PASSWORD environnement variables are necessary for sending confirmation emails to the newly registered users.
set FLASK_APP=run.py
set MAIL_USERNAME=<your-gmail-email-address>
set MAIL_PASSWORD=<your-gmail-password>
  1. Run the CLI deploycommand to create the database:
flask deploy
  1. If you want to populate the database with some dummy data type:
flask shell
>>> from app.fake import users, posts, follows, comments
>>> users()
>>> posts()
>>> follows()
>>> comments()
  1. Run the application and go to localhost:5000 to see the application running:
flask run
  1. You can run the unit tests using the CLI testcommand:
flask test

License:

This software is licensed under the MIT License.