Skip to content

Tomopu/flask_template

Repository files navigation

Flask Template

This repository serves as a development environment template for a Flask application.

🚀 Setup

Download this repository using the link below:

⬇️ Download This Template

Extract the downloaded ZIP file and navigate to the extracted folder.

Create a .env file and set your Ngrok token by referring to the .env.sample file.

🛠 Development

Set up the development environment using venv:

python -m venv .venv

Activate the virtual environment:

source .venv/bin/activate

Install dependencies with Poetry:

poetry install

To exit the virtual environment, use the following command:

deactivate

📌 Usage

To launch the system, run the following command:

docker-compose -f compose.prod.yaml -f compose.yaml up -d

Once the system is running, you can access Ngrok's URL by opening localhost:4040 in your web browser.

Alternatively, you can start the Flask application directly with:

python flask-app/app.py

When running the Flask application directly, open localhost:5001 in your web browser to access the system.

🎯 Notes

  • Ensure you have Docker and Docker Compose installed before running the application.
  • Modify the .env file with your required environment variables before starting the system.
  • This template is designed for rapid Flask development and can be customized as needed.
  • If you change the flask-app directory name, update the following references accordingly:
    • Dockerfile
      COPY ./flask-app /src/flask-app/
      WORKDIR /src/flask-app
    • pyproject.toml
      [tool.poetry]
      name = "flask-app"
      [[tool.poetry.packages]]
      include = "flask-app"

📂 Project Structure

.
├── .env.sample
├── Dockerfile
├── README.md
├── compose.prod.yaml
├── compose.yaml
├── flask-app
│   ├── __init__.py
│   ├── app.py
│   ├── static
│   │   ├── favicon.ico
│   │   ├── images
│   │   │   └── sample-image.png
│   │   └── styles
│   │       ├── index.css
│   │       └── layout.css
│   └── templates
│       ├── index.html
│       └── layout.html
├── ngrok.yml
├── poetry.lock
└── pyproject.toml

6 directories, 16 files

About

Development environment template for a Flask app

Resources

License

Stars

Watchers

Forks

Packages

No packages published