Skip to content

ArttuKnowit/CodeBlog

Repository files navigation

Code Blog

This is a simple Flask blog application with CRUD functionality for posts, and simple user authentication. This application is made for the purpose of creating test automation and is not intended for production use. This is a fork of the original FlaskBlog project that has been developed for educational purposes.

Running Locally

Prerequisites

  • Python 3.x
  • pip

Setup

  1. Clone the repository:

    git clone <repo-url>
    cd CodeBlog
  2. (Optional) Create and activate a virtual environment:

    python3 -m venv venv
    source venv/bin/activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Initialize the database:

    python init_db.py
  5. Run the application:

    flask run

The app will be available at http://127.0.0.1:5000/

Running with Docker

Prerequisites

  • Docker

Build and Run

  1. Build the Docker image:

    docker build -t codeblog .
  2. Run the Docker container:

    docker run -p 5000:5000 codeblog

The app will be available at http://127.0.0.1:5000/


Run tests in docker

Create docker network:

docker network create codeblog_network

Build both containers (tests and the application)

docker build -t codeblog .
docker build -t codeblog_tests -f robot_tests/Dockerfile

Run both containers in the same network.

docker run -p 5000:5000 --network codeblog_network --name codeblog_app codeblog
...
docker run --network codeblog_network codeblog_tests

Run tests with docker compose

Project Structure

  • app.py: Main Flask application
  • init_db.py: Script to initialize the database
  • schema.sql: SQL schema for the database
  • templates/: HTML templates
  • static/: Static files (CSS)
  • database.db: SQLite database file

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •