Search

How to Deploy Django, FastAPI or Flask on Laravel Cloud

How to Deploy Django, FastAPI or Flask on Laravel Cloud

Laravel Cloud now has a Python runtime. If you have a Django admin, a FastAPI inference endpoint or a small Flask service sitting beside your Laravel app, you can host it on the same platform, under the same bill, with the same preview environments.

Also Read: Laravel Cloud Updates 2026: New Languages, Pricing & Features - News

This guide walks through the setup and the three mistakes most likely to break your first deploy.

What you need

  • Python 3.10, 3.11, 3.12, 3.13 or 3.14 (3.12 is the default)
  • One of pyproject.toml, requirements.txt, Pipfile or setup.py in the app's root
  • A repository on GitHub, GitLab or Bitbucket
  • gunicorn (Django, Flask) or uvicorn (FastAPI) in your dependencies

That last point matters. Laravel Cloud will not install a WSGI or ASGI server for you, so add it to your dependencies before you deploy.

Step 1: Pin your Python version

There is no Python version dropdown in the dashboard. Cloud reads the version from a .python-version file and falls back to requires-python in pyproject.toml:

[project]
requires-python = ">=3.12"

If the version it finds is outside the supported range, Cloud builds on the default version and logs a warning. Check the build log on your first deploy.

Step 2: Create the application

In the Cloud dashboard, choose New application, connect your Git provider, pick the repository and a region. Cloud detects a Python project from the files above, then spots Django, FastAPI or Flask from your dependencies. Anything else runs as a generic Python app.

If the Python app lives in a monorepo next to your Laravel code, Cloud lists the top-level folders so you can choose the one to deploy. Create one Cloud application per folder.

Step 3: Let Cloud install dependencies

You usually don't need a build command. Cloud installs dependencies with whichever tool matches your lockfile: uv, Poetry, Pipenv or pip. Add a build command only for extra steps, such as Django static files:

python manage.py collectstatic --noinput

Step 4: Check the start command

Cloud pre-fills a start command by finding your Django WSGI module or your Flask/FastAPI app module. If it can't find one, it falls back to these defaults:

FrameworkFallback start command
Djangogunicorn <project>.wsgi --bind [::]:$PORT
FastAPIuvicorn main:app --host '' --port $PORT
Flaskgunicorn app:app --bind [::]:$PORT
Genericpython main.py

For Django, replace <project> with the folder that contains wsgi.py. If you leave the placeholder in, the deploy fails with an error telling you so.

Step 5: Environment variables and databases

Add your variables in the dashboard. Cloud sets them on the process rather than writing a .env file, so read them from os.environ. You don't need python-dotenv.

Also Read: Laravel Private Cloud: HIPAA, Self-Hosted GitLab & ElastiCache

Attach a MySQL or Postgres database, or a Valkey cache, from the infrastructure canvas and Cloud injects DATABASE_URL or REDIS_URL automatically. In Django, dj-database-url turns that into a DATABASES setting in one line.

Then press Deploy.

What you get, and what you don't

Python apps get scale to zero, preview environments, custom domains, object storage and worker clusters. They do not get Cloud's managed queues or scheduled tasks, which are Laravel and Symfony only for now. Run Celery, RQ or Dramatiq as your own process on a worker cluster instead.

Common gotchas

  1. Missing server package. No gunicorn/uvicorn in dependencies means nothing starts.
  2. Hard-coded port. Bind to $PORT, not 8000.
  3. Django ALLOWED_HOSTS. Add your .laravel.cloud domain and any custom domain, or every request returns a 400.

FAQ

Which Python frameworks does Laravel Cloud detect? Django, FastAPI and Flask. Other Python apps run as generic Python applications.

Can I use uv or Poetry? Yes. Cloud chooses uv, Poetry, Pipenv or pip based on the lockfile in your repo.

How do I choose the Python version? Add a .python-version file or set requires-python in pyproject.toml.

Related on The Web Tier

Sources: Laravel Cloud quickstart (Python tab) · Laravel Cloud runtimes

TWT Staff

TWT Staff

Writes about Programming, tech news, discuss programming topics for web developers (and Web designers), and talks about SEO tools and techniques

Your experience on this site will be improved by allowing cookies Cookie Policy