GithubHelp home page GithubHelp logo

akakiev / flaskblog Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 10 KB

FlaskBlog is a web application built with Flask, SQLite, HTML, Jinja2, and Bootstrap. It allows users to create, read, update, and delete blog posts.

License: MIT License

Python 71.55% HTML 28.45%

flaskblog's Introduction

FlaskBlog Project

FlaskBlog is a web application built with Flask, SQLite, HTML, Jinja2, and Bootstrap. It allows users to create, read, update, and delete blog posts.

Features

  • Create new blog posts
  • Display all blog posts
  • View individual blog posts
  • Edit existing blog posts
  • Delete blog posts

Project Structure

flaskblog/
│
├── app/
│   ├── __init__.py
│   ├── routes.py
│   ├── models.py
│   ├── templates/
│   │   ├── layout.html
│   │   ├── home.html
│   │   ├── post.html
│   │   ├── edit_post.html
│   │   ├── create_post.html
│   ├── static/
│       ├── css/
│           ├── styles.css
├── instance/
│   ├── flaskblog.sqlite
├── config.py
├── run.py
└── requirements.txt

Getting Started

Prerequisites

  • Python 3.x
  • pip (Python package installer)

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/flaskblog.git
    cd flaskblog
  2. Create a virtual environment:

    python -m venv venv
  3. Activate the virtual environment:

    • On Windows:
      venv\Scripts\activate
    • On macOS/Linux:
      source venv/bin/activate
  4. Install the required packages:

    pip install -r requirements.txt
  5. Set up the database:

    flask shell
    >>> from app import db
    >>> db.create_all()
    >>> exit()

Running the Application

  1. Start the Flask development server:

    python run.py
  2. Open your web browser and go to:

    http://127.0.0.1:5000
    

Project Files

app/__init__.py

This file initializes the Flask application and sets up the SQLAlchemy database.

app/routes.py

This file defines the routes (URL endpoints) for the application, handling the logic for creating, reading, updating, and deleting blog posts.

app/models.py

This file contains the SQLAlchemy database model for the blog posts.

app/templates/

This directory contains the HTML templates for rendering the web pages.

  • layout.html: Base template that includes the navigation bar and integrates Bootstrap.
  • home.html: Template for displaying the list of blog posts.
  • post.html: Template for displaying a single blog post.
  • edit_post.html: Template for editing an existing blog post.
  • create_post.html: Template for creating a new blog post.

config.py

Configuration file for setting up the Flask application, including the database URI and secret key.

run.py

Entry point for the Flask application. It runs the development server.

requirements.txt

Lists the Python packages required for the project.

Contributing

If you want to contribute to this project, please fork the repository and create a pull request.

License

This project is licensed under the MIT License.

Acknowledgements

flaskblog's People

Contributors

akakiev avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.