Skip to content

HR-coding/BlogWebsite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask Blog Website

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.

1) How to Run Locally

You must have Python and pip installed.

1. Clone the repository:

git clone https://github.com/HR-coding/BlogWebsite.git
cd BlogWebsite

2. 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.txt

4. Run the application: The main.py file contains the main Flask application.

python main.py

5. View your website: Open your web browser and go to http://127.0.0.1:5000. You should see your blog's homepage.


2)How to Deploy (Hosting)

Important: You CANNOT Host This on GitHub Pages

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.

The Correct Way to Host This App

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):

  1. Sign up for a free account on Render.com.
  2. On your dashboard, click "New +" and select "Web Service".
  3. Connect your GitHub account and select your BlogWebsite repository.
  4. 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 Procfile to run the web server.
  5. Click "Create Web Service".

Render will automatically build and deploy your site, giving you a live URL (like blogwebsite.onrender.com).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors