A professional Flask-based web project following Lanqiao's tutorial, implementing user authentication, database migrations, and more.
This project is a Flask-based web application. It aims to implement a fully functional website with user authentication, a blog system, and a clean UI using Flask-Bootstrap.
- User Authentication: Complete functionality for user registration, login, and logout.
- Email Verification: Automatic email verification upon registration using
Flask-Mail
, including token generation and email templates. - Secure Password Hashing: Passwords are securely hashed using
werkzeug.security
to protect user credentials. - Database Management: Database migrations are handled by
Flask-Migrate
, allowing for seamless schema changes. - Role-Based Access Control: Implementation of user roles and permissions, ensuring that only authorised users can access specific features.
- Dynamic User Profiles: Users can manage their profiles, including attributes such as
age
,gender
,phone_number
,location
, andabout_me
. - User Activity Tracking: Tracks and displays the last seen time for users, enhancing user engagement.
- Responsive User Interface: A clean and responsive user interface built with
Flask-Bootstrap
, ensuring a good user experience across devices. - Error Handling: Custom error pages for 404 and 500 errors to improve user experience.
- Asynchronous Email Sending: Emails are dispatched in a separate thread to prevent blocking the main application thread.
- Form Validation: Utilises
Flask-WTF
for form handling and validation, ensuring user input is properly checked. - Dynamic Time Formatting: Uses
Flask-Moment
for displaying and formatting dates and times dynamically. - Blog system with posts and comments (coming soon...)
- User profile and settings (coming soon...)
git clone https://github.com/fredsun02/flask-website.git
cd flask-website
python3 -m venv venv
source venv/bin/activate # macOS/Linux
venv\Scripts\activate # Windows
pip install -r requirements.txt
Before running the application, export the necessary environment variables:
export FLASK_APP=manage.py
export FLASK_ENV=development
export FLASK_DEBUG=1
flask db init
flask db migrate -m "Initial migration"
flask db upgrade
flask run
Now 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