FlaskBlog is a web application built with Flask, SQLite, HTML, Jinja2, and Bootstrap. It allows users to create, read, update, and delete blog posts.
- Create new blog posts
- Display all blog posts
- View individual blog posts
- Edit existing blog posts
- Delete blog posts
flaskblog/
│
├── app/
│ ├── __init__.py
│ ├── routes.py
│ ├── models.py
│ ├── templates/
│ │ ├── layout.html
│ │ ├── home.html
│ │ ├── post.html
│ │ ├── edit_post.html
│ │ ├── create_post.html
│ ├── static/
│ ├── css/
│ ├── styles.css
├── instance/
│ ├── flaskblog.sqlite
├── config.py
├── run.py
└── requirements.txt
- Python 3.x
- pip (Python package installer)
-
Clone the repository:
git clone https://github.com/yourusername/flaskblog.git cd flaskblog
-
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
- On Windows:
-
Install the required packages:
pip install -r requirements.txt
-
Set up the database:
flask shell >>> from app import db >>> db.create_all() >>> exit()
-
Start the Flask development server:
python run.py
-
Open your web browser and go to:
http://127.0.0.1:5000
This file initializes the Flask application and sets up the SQLAlchemy database.
This file defines the routes (URL endpoints) for the application, handling the logic for creating, reading, updating, and deleting blog posts.
This file contains the SQLAlchemy database model for the blog posts.
This directory contains the HTML templates for rendering the web pages.
layout.html
: Base template that includes the navigation bar and integrates Bootstrap.home.html
: Template for displaying the list of blog posts.post.html
: Template for displaying a single blog post.edit_post.html
: Template for editing an existing blog post.create_post.html
: Template for creating a new blog post.
Configuration file for setting up the Flask application, including the database URI and secret key.
Entry point for the Flask application. It runs the development server.
Lists the Python packages required for the project.
If you want to contribute to this project, please fork the repository and create a pull request.
This project is licensed under the MIT License.