# AddUvicornApp

- Module: [Aspire.Hosting.Python](/reference/api/go/aspire.hosting.python.md)
- Version: `17.0.0`
- Kind: `method`
- Defined on: `DistributedApplicationBuilder`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)

Adds a Uvicorn-based Python application to the distributed application builder with HTTP endpoint configuration.

## Remarks

This method configures the application to use Uvicorn as the ASGI server and exposes an HTTP
endpoint. When publishing, it sets the entry point to use the Uvicorn executable with appropriate arguments for
host and port.
By default, the virtual environment folder is expected to be named `.venv` and located in the app directory.
Use `WithVirtualEnvironment` to specify a different virtual environment path.
In non-publish mode, the `--reload` flag is automatically added to enable hot reload during development.

## Definition

```go
func (DistributedApplicationBuilder) AddUvicornApp(
    name string,
    appDirectory string,
    app string,
) UvicornAppResource
```

## Parameters

- `name` (`string`) -- The unique name of the Uvicorn application resource.
- `appDirectory` (`string`) -- The directory containing the Python application files.
- `app` (`string`) -- The ASGI app import path which informs Uvicorn which module and variable to load as your web application. For example, "main:app" means "main.py" file and variable named "app".

## Returns

[`UvicornAppResource`](/reference/api/go/aspire.hosting.python/uvicornappresource.md) -- A resource builder for further configuration of the Uvicorn Python application resource.

Returns a handle; failures surface later via `Err()`.

## Applies to

- `DistributedApplicationBuilder`
