This is a simple blog application built with Flask, SQLAlchemy, and other modern web technologies. Users can register, log in, create posts, and comment on posts. Admin users have the ability to edit and delete posts.
- User registration and authentication
- Create, edit, and delete blog posts
- Add and display comments on blog posts
- Admin-only privileges for editing and deleting posts
- Gravatar integration for user avatars
- CKEditor integration for rich text editing
These instructions will help you set up the project on your local machine for development and testing purposes.
- Python 3.8 or higher
- Flask
- SQLAlchemy
- Flask-Login
- Flask-WTF
- Flask-Bootstrap
- Flask-CKEditor
-
Clone the repository:
git clone https://github.com/yourusername/flask-blog.git cd flask-blog
-
Create a virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Set up the database:
flask db init flask db migrate flask db upgrade
-
Run the application:
flask run
Before running the application, make sure to configure your environment variables. Create a .env
file in the root directory of your project with the following content:
FLASK_APP=main.py
FLASK_ENV=development
SECRET_KEY=your_secret_key
SQLALCHEMY_DATABASE_URI=sqlite:///blog_posts.db