A full-stack Content Management System (CMS) built with Python and Flask. This application allows an administrator to log in, write, edit, and delete articles, while visitors can browse and read content. Additionally, it uses a PostgreSQL database for storage.
- Public View: Home page listing all articles (sorted by newest) and individual article pages.
- Admin Dashboard: Secure interface to manage content.
- CRUD Operations: Create, Read, Update, and Delete articles.
- Authentication: Session-based login system.
- Database: Persistent storage using PostgreSQL and SQLAlchemy ORM.
- Backend: Python 3, Flask
- Database: PostgreSQL, SQLAlchemy
- Frontend: HTML5, Jinja2 Templates
- Driver: Psycopg2-binary
Ensure you have the following installed on your machine:
- Python 3.x
- PostgreSQL (v12 or higher recommended)
- pip (Python package manager)
git clone https://github.com/syssefim/Personal-Blog-Web-App
cd Personal-Blog-Web-App
pip install flask flask-sqlalchemy psycopg2-binary python-dotenv
You need to create the database and user. Open your PostgreSQL tool (pgAdmin or psql) and run:
CREATE DATABASE personal_blog_db;
CREATE USER personal_blog_admin WITH PASSWORD 'password123';
GRANT ALL PRIVILEGES ON DATABASE personal_blog_db TO personal_blog_admin;
GRANT ALL ON SCHEMA public TO personal_blog_admin;
Create a file named .env in the root directory to store sensitive credentials, and add the following lines:
DATABASE_URL=postgresql://personal_blog_admin:password123@localhost/personal_blog_db
SECRET_KEY=your_secret_key_here
Now, populate the database with sample data by running the following command in the terminal:
python3 seed_db.py
In your terminal, run:
python3 app.py
Open your web browser and go to: http://127.0.0.1:5000/