{"id":28578420,"url":"https://github.com/powerappsdarren/flask-python-template","last_synced_at":"2025-06-11T01:10:13.113Z","repository":{"id":295449548,"uuid":"990143531","full_name":"PowerAppsDarren/Flask-Python-Template","owner":"PowerAppsDarren","description":"A great starting point for creating minimalistic web sites/applications using Python","archived":false,"fork":false,"pushed_at":"2025-05-25T16:15:49.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-05-25T16:39:59.634Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PowerAppsDarren.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-25T15:37:37.000Z","updated_at":"2025-05-25T16:15:53.000Z","dependencies_parsed_at":"2025-05-25T16:40:03.896Z","dependency_job_id":null,"html_url":"https://github.com/PowerAppsDarren/Flask-Python-Template","commit_stats":null,"previous_names":["powerappsdarren/flask-python-template"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PowerAppsDarren%2FFlask-Python-Template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PowerAppsDarren%2FFlask-Python-Template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PowerAppsDarren%2FFlask-Python-Template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PowerAppsDarren%2FFlask-Python-Template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PowerAppsDarren","download_url":"https://codeload.github.com/PowerAppsDarren/Flask-Python-Template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PowerAppsDarren%2FFlask-Python-Template/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259178542,"owners_count":22817389,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-11T01:10:08.430Z","updated_at":"2025-06-11T01:10:13.106Z","avatar_url":"https://github.com/PowerAppsDarren.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flask Python Template\n\nA well-structured, minimalistic template for creating web applications with Python and Flask following best practices.\n\n## Features\n\n- ✨ Application factory pattern\n- 📁 Modular structure with blueprints\n- 🔧 Environment-based configuration\n- 🧪 Testing setup included\n- 🎨 Organized static files and templates\n- 📦 Minimal dependencies\n- 🚀 Production-ready structure\n\n## Project Structure\n\n```\nFlask-Python-Template/\n├── app/\n│   ├── __init__.py         # Application factory\n│   ├── main/              # Main blueprint\n│   │   ├── __init__.py\n│   │   └── routes.py\n│   ├── errors/            # Error handlers blueprint\n│   │   ├── __init__.py\n│   │   └── handlers.py\n│   ├── static/            # Static files\n│   │   ├── css/\n│   │   │   └── main.css\n│   │   └── js/\n│   └── templates/         # Jinja2 templates\n│       ├── base.html\n│       ├── index.html\n│       ├── about.html\n│       └── errors/\n│           ├── 404.html\n│           └── 500.html\n├── tests/                 # Test modules\n│   ├── __init__.py\n│   └── test_basic.py\n├── scripts/              # Helper scripts\n│   ├── dev.py           # Development helper\n│   └── setup.py         # Setup script\n├── .env.example          # Environment variables example\n├── .gitignore           # Git ignore file\n├── config.py            # Configuration module\n├── requirements.txt     # Python dependencies\n├── run.py              # Application entry point\n└── README.md           # This file\n```\n\n## Prerequisites\n\n- Python 3.8 or higher\n- pip (Python package manager)\n- Git\n\n## 🚀 First Time Setup\n\n### Windows Users\n```bash\n# Clone and enter the repository\ngit clone https://github.com/PowerAppsDarren/Flask-Python-Template\ncd Flask-Python-Template\n\n# Run the quick start script\nscripts\\quickstart.bat\n```\n\n### Mac/Linux Users\n```bash\n# Clone and enter the repository\ngit clone https://github.com/PowerAppsDarren/Flask-Python-Template\ncd Flask-Python-Template\n\n# Make the script executable and run it\nchmod +x scripts/quickstart.sh\n./scripts/quickstart.sh\n```\n\n### Alternative: Manual Setup\n```bash\n# 1. Run the setup script\npython scripts/setup.py\n\n# 2. Activate the virtual environment\n# Windows:\nvenv\\Scripts\\activate\n# Mac/Linux:\nsource venv/bin/activate\n\n# 3. Run the application\npython run.py\n```\n\n## Quick Start\n\n### Option 1: Using the setup script (Recommended)\n\n```bash\n# Clone the repository\ngit clone https://github.com/PowerAppsDarren/Flask-Python-Template\ncd Flask-Python-Template\n\n# Run the setup script\npython scripts/setup.py\n```\n\n### Option 2: Manual setup\n\n1. Clone this repository:\n   ```bash\n   git clone https://github.com/PowerAppsDarren/Flask-Python-Template\n   cd Flask-Python-Template\n   ```\n\n2. Create a virtual environment:\n   ```bash\n   python -m venv venv\n   ```\n\n3. Activate the virtual environment:\n   ```bash\n   # Windows\n   venv\\Scripts\\activate\n   \n   # macOS/Linux\n   source venv/bin/activate\n   ```\n\n4. Install dependencies:\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n5. Set up environment variables:\n   ```bash\n   # Windows\n   copy .env.example .env\n   \n   # macOS/Linux\n   cp .env.example .env\n   ```\n\n6. Run the application:\n   ```bash\n   python run.py\n   ```\n\n7. Open your browser and navigate to `http://localhost:5000`\n\n## VS Code Setup\n\n### 🚨 Important: First Time VS Code Setup\n\nIf you're having issues with VS Code not finding Flask or the Python interpreter:\n\n```bash\n# Run this special VS Code setup script\npython setup-vscode.py\n```\n\nThen follow the on-screen instructions carefully.\n\n### Manual VS Code Setup\n\n1. **Create virtual environment first**:\n   ```bash\n   python -m venv venv\n   ```\n\n2. **Open VS Code**:\n   ```bash\n   code .\n   ```\n\n3. **Select Python Interpreter** (This is the crucial step!):\n   - Look at the bottom-left corner of VS Code\n   - Click on the Python version shown (or \"Select Python Interpreter\" if shown)\n   - Choose: `.\\venv\\Scripts\\python.exe` (Windows) or `./venv/bin/python` (Linux/Mac)\n   - If you don't see this option:\n     - Press `Ctrl+Shift+P` (or `Cmd+Shift+P` on Mac)\n     - Type: \"Python: Select Interpreter\"\n     - Click \"Enter interpreter path...\"\n     - Browse to and select: `venv\\Scripts\\python.exe`\n\n4. **Reload VS Code** (Important!):\n   - Press `Ctrl+R` (or `Cmd+R` on Mac)\n   - Or close and reopen VS Code\n\n5. **Now F5 will work!**\n\n### Keyboard Shortcuts\n\n- **F5**: Start debugging Flask application\n- **Ctrl+Shift+B**: Show build tasks menu\n  - Default: Run Flask app locally\n  - Docker: Build and Run\n  - Run Tests\n  - Install Dependencies\n\n### Available Commands\n\n#### Local Development\n```bash\n# Run Flask directly\npython run.py\n\n# Using the helper script\npython scripts/dev.py flask\n```\n\n#### Docker Development\n```bash\n# Build and run with Docker Compose\ndocker compose up --build\n\n# Run without rebuilding\ndocker compose up\n\n# Stop containers\ndocker compose down\n\n# Using the helper script\npython scripts/dev.py docker\n```\n\n#### Testing\n```bash\n# Run tests\npytest\n\n# Run with coverage\npytest --cov=app tests/\n\n# Using the helper script\npython scripts/dev.py test\n```\n\n## Troubleshooting\n\n### \"Failed to resolve env\" error in VS Code\n\nThis is the most common issue. To fix:\n\n1. **Run the VS Code setup script**:\n   ```bash\n   python setup-vscode.py\n   ```\n\n2. **Manually select the interpreter**:\n   - Delete the `.vscode/settings.json` file\n   - Restart VS Code\n   - Press `Ctrl+Shift+P` → \"Python: Select Interpreter\"\n   - Choose \"Enter interpreter path...\"\n   - Navigate to `venv\\Scripts\\python.exe` and select it\n\n3. **Alternative fix**:\n   - Close VS Code completely\n   - Delete the `.vscode` folder\n   - Run: `python setup-vscode.py`\n   - Open VS Code and select the interpreter when prompted\n\n### \"No module named flask\" error\n\nThis means Flask is not installed. Make sure you:\n1. Run the setup script first: `python scripts/setup.py`\n2. Activate the virtual environment: `venv\\Scripts\\activate` (Windows) or `source venv/bin/activate` (Mac/Linux)\n3. Then run the application: `python run.py`\n\n### VS Code Issues\n\nIf VS Code is not using the virtual environment:\n1. Open Command Palette (Ctrl+Shift+P)\n2. Type \"Python: Select Interpreter\"\n3. Choose the interpreter in `./venv/Scripts/python.exe` (Windows) or `./venv/bin/python` (Mac/Linux)\n4. Restart VS Code\n\n### Port already in use\n\nIf port 5000 is already in use, you can specify a different port:\n```bash\npython run.py\n# or set environment variable\nset FLASK_PORT=8000  # Windows\nexport FLASK_PORT=8000  # macOS/Linux\n```\n\n## Development\n\n### Running Tests\n\n```bash\npytest\n# With coverage\npytest --cov=app tests/\n```\n\n### Adding New Features\n\n1. Create a new blueprint in `app/` directory\n2. Register the blueprint in `app/__init__.py`\n3. Add templates in `app/templates/`\n4. Add static files in `app/static/`\n\n## Configuration\n\nThe application supports multiple configurations:\n\n- `development` - Debug mode enabled\n- `production` - Debug mode disabled, optimized for deployment\n- `testing` - Special configuration for running tests\n\nSet the configuration using the `FLASK_CONFIG` environment variable.\n\n## Deployment\n\nFor production deployment:\n\n1. Set environment variables:\n   ```bash\n   export FLASK_CONFIG=production\n   export SECRET_KEY=your-secure-secret-key\n   ```\n\n2. Use a production WSGI server:\n   ```bash\n   gunicorn -w 4 -b 0.0.0.0:8000 run:app\n   ```\n\n3. Set up a reverse proxy (nginx/Apache)\n4. Enable HTTPS\n5. Set up logging and monitoring\n\n## License\n\nThis template is open source and available under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpowerappsdarren%2Fflask-python-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpowerappsdarren%2Fflask-python-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpowerappsdarren%2Fflask-python-template/lists"}