flask-base/README.md

1.9 KiB

Flask Base Project

A starter template for Flask web applications with Docker support, user authentication, and deployment configurations.

Features

  • User registration, login, and dashboard functionality
  • Docker and Docker Compose for containerized environments
  • PostgreSQL database
  • Environment configuration via .env file
  • Jinja2 templating with base HTML structure
  • Git version control integration

Prerequisites

  • Python 3.9+
  • Docker 20.10+
  • Docker Compose 2.4+

Installation

  1. Clone the repository:
git clone ssh://git@git.leoan.se:30009/andreas/flask-base.git
cd flask-base
  1. Install Python dependencies:
pip install -r requirements.txt
  1. Configure environment variables:
cp .env.example .env
# Edit .env with your configuration

Running the Application

Development Mode

flask run --port=5000 --debug

Production Mode with Docker

docker-compose up --build

Configuration

Essential environment variables in .env:

FLASK_APP=app.py
FLASK_ENV=production
DATABASE_URL=postgresql://user:password@db:5432/appdb
SECRET_KEY=your-secret-key-here

Deployment

  1. Build production Docker image:
docker build -t flask-base:latest .
  1. Start container with database:
docker-compose -f docker-compose.prod.yml up -d

Project Structure

flask-base/
├── app.py
├── Dockerfile
├── docker-compose.yml
├── requirements.txt
└── templates/
    ├── base.html
    ├── login.html
    ├── register.html
    └── dashboard.html

Contributing

  1. Create your feature branch:
git checkout -b feature/your-feature
  1. Commit changes:
git commit -m 'Add some feature'
  1. Push to branch:
git push origin feature/your-feature

License

MIT License - see LICENSE for details