A professional Flask-based web project following Lanqiao's tutorial, implementing user authentication, database migrations, and more.
This is a full-stack web application built with Flask, featuring a modular design and blueprint architecture that delivers a complete user system, blog platform, and permission management. The project utilises SQLAlchemy ORM for database operations, supports Markdown content creation, and implements efficient permission control through bitwise operations. The system integrates email verification, user following, tag management, and other features, whilst providing a responsive interface design that ensures an excellent user experience across various devices.
- User Authentication: Complete functionality for user registration, login, and logout with email verification and password reset support.
- Permission Management: Efficient permission control system based on bitwise operations, supporting multiple user roles (administrator, moderator, regular user, etc.).
- Blog Platform: Markdown editing and preview support, automatic conversion to safe HTML with XSS attack prevention.
- Content Management: Blog publishing, editing, paginated display, and tag management functionality.
- User Interaction: User following system, supporting follow/unfollow actions, status display, and following lists.
- Backend Framework: Flask
- Database: MySQL + SQLAlchemy ORM
- Fronted Framework: Bootstrap 3 + CSS + HTML5
- Template Engine: Jinja2
git clone https://github.com/fredsun02/flask-website.git
cd flask-websitepython3 -m venv venv
source venv/bin/activate # macOS/Linux
venv\Scripts\activate # Windowspip install -r requirements.txtBefore running the application, export the necessary environment variables:
export FLASK_APP=manage.py
export FLASK_ENV=development
export FLASK_DEBUG=1flask db init
flask db migrate -m "Initial migration"
flask db upgradeflask runNow open your browser and visit: http://127.0.0.1:5000
flask-website/
├── README.md # Project documentation
├── log.md # Development logs
├── manage.py # CLI entry point
├── migrations/ # Database migrations
├── requirements.txt # Dependencies
├── scripts/ # Utility scripts
│ └── generate_fake_data.py # Test data generator
└── weblog/ # Main application package
├── handlers/ # View functions (blueprints)
├── templates/ # HTML templates
├── static/ # Static files (CSS, JS, etc.)
├── app.py # Application factory
├── configs.py # Configuration settings
├── decorators.py # Custom decorators
├── email.py # Email functionality
├── forms.py # Form definitions
└── models.py # Database models
This project is licensed under the MIT Licence - see the LICENCE file for details.
Built with Flask and Love by fredsun02