This project contains a blog application built using FastAPI, SQLAlchemy, and Jinja2. The application is designed to demonstrate the use of modern Python web development practices with asynchronous database handling and template rendering.
- Create, read, update, and delete blog posts.
- MySQL database integration using SQLAlchemy.
- Asynchronous database handling with aiomysql.
- Jinja2 templates for rendering HTML pages.
- Python 3.8 or higher
- MySQL database instance
-
Clone the repository:
git clone <repository-url> cd <repository-directory>
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install the required dependencies: check
requirements.txt
-
Set up the database:
- Ensure your MySQL database is running.
- Create a new database for the blog application.
- Update the database connection settings in the project configuration.
-
Run the application:
cd /Blog uvicorn app.main:app --reload
Replace
app.main
with the actual path to your FastAPI application if different. -
Access the application
- SQLAlchemy: ORM for database interactions.
- mysql-connector-python: MySQL connector for Python.
- aiomysql: Asynchronous MySQL driver.
- FastAPI: Web framework for building APIs and web applications.
- Jinja2: Templating engine for rendering HTML.