--- title: "Python" description: "Deploy Python applications on Miget with automatic dependency and framework detection." --- Miget Buildpacks automatically detect and build your Python applications when you select **Auto detection (Miget Buildpacks)** as the build method. Django, Flask, and other frameworks are supported out of the box. For the full reference, visit the [migetpacks Python documentation](https://migetpacks.com/languages/python). ## Detection Your application is detected as Python when one of these files is present in the root directory: - `requirements.txt` - `setup.py` - `Pipfile` - `pyproject.toml` ## Version Detection The Python version is determined from the following sources, in order of priority: 1. `.python-version` 2. `runtime.txt` 3. `pyproject.toml` (e.g., `requires-python` or tool-specific settings) If no version is specified, a recent stable Python version is used. ## Build Process During the build, the following steps are performed: 1. **Package manager detection** - The package manager is auto-detected: - `requirements.txt` → pip - `pyproject.toml` with a compatible configuration → uv (or pip as fallback) 2. **Dependency installation** - All dependencies are installed using the detected package manager. 3. **System packages** - Common system-level dependencies are auto-detected and installed for packages such as `psycopg`, `mysqlclient`, `lxml`, and others that require native libraries. 4. **Django support** - If Django is detected: - `collectstatic` runs automatically to gather static assets. - `gunicorn` or `uvicorn` is used as the application server. ## Run Command The run command is resolved in the following order: 1. Django with gunicorn (if Django and gunicorn are detected) 2. Django with uvicorn (if Django and uvicorn are detected) 3. `web` process in a `Procfile` 4. Default module entry point You can also override the run command directly in the Miget dashboard when creating your app or changing the deployment source. Builder settings showing Run Command override ## Configuration You can customize the build and runtime behavior through the Miget dashboard and repository configuration files: - **Environment variables** - Set under **Settings -> Variables** in the Miget dashboard - **Procfile** - Define the start command at the root of your repository - **app.json** - Application manifest for additional configuration - **Project Path** - For monorepo setups, specify the subdirectory containing your application code in the **Advanced** tab - **Pre-Deploy Command** - Run a command before deployment (e.g., database migrations) in the **Advanced** tab - **Post-Deploy Command** - Run a command after successful deployment (e.g., seeding data, cache warming) in the **Advanced** tab ## Docker Hardened Images You can enable Docker Hardened Images (DHI) in the **Advanced** tab when creating your app or changing the deployment source. When enabled, your application is built using distroless runtime images with a minimal attack surface, no shell, and no package manager. Advanced builder settings with Docker Hardened Images toggle For the complete reference, see the [migetpacks Python documentation](https://migetpacks.com/languages/python).