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.
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.
-
Pull the Docker Image:
docker pull joeuzo/flask-blog:tagname
-
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]
-
Run the Docker Container:
docker run --env-file .env -p 5000:5000 joeuzo/flask-blog:tagname
-
Clone the Repository:
git clone https://github.com/JoeUzo/Blog-with-Flask.git cd Blog-with-Flask
-
Create a Virtual Environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install Dependencies:
pip install -r requirements.txt
-
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
-
Initialize the Database:
flask db init flask db migrate -m "Initial migration." flask db upgrade
-
Run the Application:
flask run
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.
- 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
Contributions are welcome! If you would like to contribute, please follow these steps:
- Fork the repository
- Create a new branch (
git checkout -b feature-branch
) - Make your changes and commit them (
git commit -m 'Add some feature'
) - Push to the branch (
git push origin feature-branch
) - Create a new Pull Request
You can find the Docker image for this project on Docker Hub:
To run the Docker image:
docker pull joeuzo/flask-blog:tagname
docker run --env-file .env -p 5000:5000 joeuzo/flask-blog:tagname
This project is licensed under the MIT License. See the LICENSE file for details.