Deploy a Python App (Flask / FastAPI)¶
This guide covers deploying Python web applications that are not Django — such as Flask, FastAPI, Starlette, or any WSGI/ASGI app — to your own server using Appliku.
Tip
If you are deploying a Django application, see the dedicated Deploy Django guide instead.
Prerequisites¶
Before you begin, make sure you have:
- A Python web application whose dependencies are declared in the root of the repository, either as
pyproject.toml+uv.lock(recommended) or arequirements.txt - Your code pushed to a GitHub or GitLab repository
- An Appliku account with at least one server set up
Step 1: Create an Application from GitHub¶
Go to the Applications page in your Appliku dashboard and click + Add Application.
Select GitHub (or GitLab) as the source, then fill in the form:
- Application name — a descriptive name for your app
- Repository — select your Python repository
- Branch — the branch to deploy from (e.g.,
mainormaster) - Server — the server to deploy to
Click Create Application.
Step 2: Select the Python Build Image¶
On the application overview page, go to Settings and open the Build Settings tab.
Change the Base Docker Image to a Python option matching your project's Python version. Prefer one of the (uv) images, e.g. Python 3.14 (uv) — they use uv, which installs dependencies considerably faster than pip and understands both dependency formats.
You do not need to set a build command to install dependencies. The image does it for you:
- If the repo has a
pyproject.toml, a uv image runsuv sync --frozenfrom it anduv.lock. Both files must be committed and in sync, or the build fails. - Otherwise it falls back to installing from
requirements.txt. - The plain (non-uv) Python images install from
requirements.txtonly.
Gunicorn is preinstalled by the image, so you do not have to declare it yourself.
Click Save Changes.
Step 3: Set the Container Port¶
Appliku routes HTTP traffic to your web process container. The default port is 8000, which works well for most Python deployments.
If your application listens on a different port, go to the Build Settings tab and update the Container Port accordingly.
Step 4: Add a Web Process¶
Go to the Processes tab and add a process:
- Name:
web - Command: the command that starts your application in production
The web process is special — it is the process that receives HTTP traffic through Nginx.
Flask¶
For a Flask application, use Gunicorn as the production server:
Where app:app means "import the app object from the app module." Adjust this to match your project structure (e.g., mypackage.main:app).
FastAPI¶
For a FastAPI application, use Uvicorn:
Where main:app means "import the app object from the main module." Adjust to match your project.
For better performance in production, you can run Uvicorn workers under Gunicorn:
Other WSGI/ASGI Apps¶
For any WSGI app, Gunicorn works as a production server. For ASGI apps, use Uvicorn or Hypercorn.
Click Save and Deploy.
Step 5: Deploy¶
Appliku will build your Docker image, install dependencies, and start the web process. You can monitor the build progress on the application overview page.
Once deployed, click View Application to open your app in the browser.
Tips¶
Always Use a Production Server¶
Never run Flask's built-in development server (flask run) or Uvicorn with --reload in production. Always use Gunicorn or Uvicorn without the reload flag.
Bind to 0.0.0.0¶
Make sure your server binds to 0.0.0.0, not 127.0.0.1. Binding to localhost inside a Docker container makes the app unreachable from outside the container.
pyproject.toml vs requirements.txt¶
The (uv) build images check for pyproject.toml first and install from it and uv.lock, falling back to requirements.txt when there is no pyproject.toml. The plain Python images only ever read requirements.txt.
If you manage dependencies with Poetry or PDM, the lock file format is not one uv can read. Either move the project to uv (uv init, then uv add your dependencies), or export a requirements.txt for the build to pick up:
# Poetry
poetry export -f requirements.txt -o requirements.txt
# pip-compile (pip-tools)
pip-compile pyproject.toml -o requirements.txt
Warning
Exporting a requirements.txt alongside a Poetry-style pyproject.toml will not work on a uv image: it sees the pyproject.toml, tries uv sync --frozen, and fails on the missing or incompatible uv.lock before ever reaching your requirements.txt. Use a plain (non-uv) Python image in that case.
Adding a Release Process¶
If your app needs to run database migrations or other setup tasks after each deployment, add a release process:
- Name:
release - Command: your migration or setup command, for example:
or
The release process runs once after each successful build, before the new version starts serving traffic.
Adding a Database¶
If your application needs a database, scroll down on the application overview page and click Add Database to provision PostgreSQL or Redis on the same server. The connection URL will be automatically added to your environment variables.
Environment Variables¶
Store secrets and configuration (database URLs, API keys, secret keys) in Environment Variables rather than hardcoding them in your source code.
Related Guides¶
- Deploy Django — if you are deploying a Django application
- Processes — learn more about process types and configuration