flask-base/README.md

107 lines
1.9 KiB
Markdown

# 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
- SQLite database (with optional PostgreSQL support)
- 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:
```bash
git clone ssh://git@git.leoan.se:30009/andreas/flask-base.git
cd flask-base
```
2. Install Python dependencies:
```bash
pip install -r requirements.txt
```
3. Configure environment variables:
```bash
cp .env.example .env
# Edit .env with your configuration
```
## Running the Application
### Development Mode
```bash
flask run --port=5000 --debug
```
### Production Mode with Docker
```bash
docker-compose up --build
```
## Configuration
Essential environment variables in `.env`:
```ini
FLASK_APP=app.py
FLASK_ENV=production
DATABASE_URL=sqlite:///instance/app.db
SECRET_KEY=your-secret-key-here
```
## Deployment
1. Build production Docker image:
```bash
docker build -t flask-base:latest .
```
2. Start container with database:
```bash
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:
```bash
git checkout -b feature/your-feature
```
2. Commit changes:
```bash
git commit -m 'Add some feature'
```
3. Push to branch:
```bash
git push origin feature/your-feature
```
## License
MIT License - see [LICENSE](LICENSE) for details