Launch component icon Flask with Diploi

Launch a new Flask project and you will instantly have access to a development environment. No sign-up required.

component icon

Flask

Diploi

  • Flask
  • Python
  • Gunicorn
GitHub

Something extra?

Choose some optional add-ons to launch with Flask

Instant launch. No sign-up required.


Flask Component for Diploi

Operation

Getting started

  1. In the Dashboard, click Create Project +
  2. Under Pick Components, choose Flask. Here you can also add a frontend framework to create a monorepo app, eg, Flask for backend and React+Vite for frontend
  3. In Pick Add-ons, you can add one or multiple databases to your app
  4. Choose Create Repository to generate a new GitHub repo
  5. Finally, click Launch Stack

Full guide at https://diploi.com/blog/hosting_flask_apps

Development

During development, the container installs Node.js and nodemon to enable automatic reloads when files change. The development server is started with:

nodemon --delay 1 --watch "pyproject.toml" --watch "requirements.txt" --watch ".venv/lib/*" --watch ".venv/lib64/*" --watch "src" --ext "py" --exec "sh -c 'if [ -f pyproject.toml ]; then uv run --isolated --with . flask --app src/main.py run --host=0.0.0.0 --port=8000 --no-reload --debug; elif [ -f requirements.txt ]; then uv run --isolated --with-requirements requirements.txt flask --app src/main.py run --host=0.0.0.0 --port=8000 --no-reload --debug; else uv run --isolated flask --app src/main.py run --host=0.0.0.0 --port=8000 --no-reload --debug; fi'"

This will:

  • Watch for changes in src, pyproject.toml, requirements.txt, and the virtual environment, restarting the server automatically
  • Detect the dependency file in use and run Flask accordingly:
    • If pyproject.toml is present: installs the local package with --with .
    • If requirements.txt is present: installs dependencies with --with-requirements requirements.txt
    • Otherwise: runs Flask in a plain isolated environment
  • Makes the app available on all network interfaces at port 8000, with debug mode enabled

Production

Builds a production-ready image. During the build, dependencies are installed with uv sync. When the container starts, it runs:

uv run --frozen gunicorn -w 4 -b 0.0.0.0:8000 src.main:app

This uses the Gunicorn to serve your application on port 8000.

Links


What is Diploi?

Diploi is the single SaaS service for managing, developing and hosting your full application.

  • Consistent

    • Consistent environments from development to production
    • Adoptable incrementally - start easy, grow later
  • One-Click

    • Fast 30 second new developer onboarding
    • One-click environment setup
    • Instantly shareable testing environments
  • Zero-Install

    • Zero-install remote development
    • Versatile support for any stack pre-build or custom
Learn more