Skip to content

JoeUzo/Blog-with-Flask

Repository files navigation

Blog with Flask

A simple blog application built using Python and Flask. This project demonstrates a variety of functionalities, including user authentication, blog post creation, commenting, and more.

Table of Contents

Project Overview

The "Blog with Flask" project is a web application that allows users to create, read, update, and delete blog posts. Users can register and log in to the site, create new blog posts, and leave comments on posts. The application uses Flask for the backend, SQLAlchemy for database interactions, and various Flask extensions for additional functionalities.

Installation Instructions

Using Docker

  1. Pull the Docker Image:

    docker pull joeuzo/flask-blog:tagname
  2. Prepare the .env File: Create a .env file in your working directory with the following content:

    SECRET_KEY=your_secret_key
    DATABASE_URL=sqlite:///path/to/database.db  # Or your preferred database URL
    EMAIL_KEY=your_email_app_key
    EMAIL_ADDRESS[email protected]
  3. Run the Docker Container:

    docker run --env-file .env -p 5000:5000 joeuzo/flask-blog:tagname

Manual Installation

  1. Clone the Repository:

    git clone https://github.com/JoeUzo/Blog-with-Flask.git
    cd Blog-with-Flask
  2. Create a Virtual Environment:

    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
  3. Install Dependencies:

    pip install -r requirements.txt
  4. Set up Environment Variables: Create a .env file in the root directory and add the following variables:

    SECRET_KEY=your_secret_key
    DATABASE_URL=sqlite:///blog.db  # Or your preferred database URL
  5. Initialize the Database:

    flask db init
    flask db migrate -m "Initial migration."
    flask db upgrade
  6. Run the Application:

    flask run

Usage

Once the application is running, you can access it in your web browser at http://127.0.0.1:5000/. You can register a new account, log in, and start creating blog posts. As an admin user (with user ID 1), you have additional privileges such as editing and deleting any posts and comments.

Features

  • User Authentication (Registration, Login, Logout)
  • Create, Read, Update, and Delete (CRUD) operations for blog posts
  • Commenting system
  • Admin privileges for managing posts and comments
  • Basic contact form functionality

Contributing

Contributions are welcome! If you would like to contribute, please follow these steps:

  1. Fork the repository
  2. Create a new branch (git checkout -b feature-branch)
  3. Make your changes and commit them (git commit -m 'Add some feature')
  4. Push to the branch (git push origin feature-branch)
  5. Create a new Pull Request

Docker Image

You can find the Docker image for this project on Docker Hub:

Docker Image

To run the Docker image:

docker pull joeuzo/flask-blog:tagname
docker run --env-file .env -p 5000:5000 joeuzo/flask-blog:tagname

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Blog built with Flask.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published