This is a dynamic blog website built with the Python and Flask web framework. It uses a templates folder to dynamically render HTML and a static folder to serve CSS and JavaScript.
This project includes a homepage, an about page, a contact page with a working form (using forms.py), and a template for individual posts.
You must have Python and pip installed.
1. Clone the repository:
git clone https://github.com/HR-coding/BlogWebsite.git
cd BlogWebsite2. Create and activate a virtual environment:
- On Mac/Linux:
python3 -m venv venv source venv/bin/activate - On Windows:
python -m venv venv venv\Scripts\activate
3. Install the required packages:
This project uses a requirements.txt file to manage its dependencies.
pip install -r requirements.txt4. Run the application:
The main.py file contains the main Flask application.
python main.py5. View your website:
Open your web browser and go to http://127.0.0.1:5000. You should see your blog's homepage.
GitHub Pages is a static site host. It can only serve plain HTML, CSS, and JS files.
This project is a dynamic Python/Flask application. It requires a server to run the Python code in main.py before it can send any HTML to the user.
You must use a Platform as a Service (PaaS) that can run Python code. Your repository is already perfectly set up for this because it includes a Procfile and requirements.txt.
Recommended Free Hosting Services:
- Render (Easiest and most popular free-tier option)
- Railway
How to deploy (using Render as an example):
- Sign up for a free account on Render.com.
- On your dashboard, click "New +" and select "Web Service".
- Connect your GitHub account and select your
BlogWebsiterepository. - Render will automatically detect your project:
- Runtime: It will see you have a Python project.
- Build Command:
pip install -r requirements.txt - Start Command: It will use your
Procfileto run the web server.
- Click "Create Web Service".
Render will automatically build and deploy your site, giving you a live URL (like blogwebsite.onrender.com).