You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/fundamentals/aspire-sdk-templates.md
+13-14Lines changed: 13 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,12 +39,11 @@ The following Aspire solution templates are available, assume the solution is na
39
39
40
40
<aname="python-app"></a>
41
41
42
-
-**Aspire Python App**: A full-stack Aspire application with a Python backend and JavaScript frontend. This template includes:
42
+
-**Aspire Python App**: A full-stack Aspire application with a Python backend and JavaScript frontend. This template uses a file-based AppHost and includes:
43
43
44
-
-[**AspireSample.AppHost**](#app-host): An orchestrator project to connect and configure services.
45
-
-[**AspireSample.ServiceDefaults**](#service-defaults): A shared project for common configurations.
46
-
-**AspireSample.Backend**: A Python backend using FastAPI framework with OpenTelemetry instrumentation.
47
-
-**AspireSample.Frontend**: A JavaScript frontend using React framework.
44
+
-**apphost.cs**: A file-based AppHost that orchestrates the Python backend and JavaScript frontend.
45
+
-**app**: A Python backend using [FastAPI](https://fastapi.tiangolo.com/) framework with OpenTelemetry instrumentation.
46
+
-**frontend**: A JavaScript frontend using [React](https://react.dev/) framework with Vite.
48
47
49
48
> [!NOTE]
50
49
> The Aspire Python template is currently under development. For more information and updates, see [GitHub: Aspire issue #11865](https://github.com/dotnet/aspire/issues/11865). For now, you can manually add Python applications to an existing Aspire solution using the guidance in [Orchestrate Python apps in Aspire](../get-started/build-aspire-apps-with-python.md).
@@ -108,30 +107,30 @@ To create an Aspire solution or project using the .NET CLI, use the [dotnet new]
108
107
109
108
To create a basic [Aspire AppHost](app-host-overview.md) project targeting the latest .NET version:
110
109
111
-
```dotnetcli
112
-
dotnet new aspire-apphost
110
+
```Aspire
111
+
aspire new aspire-apphost
113
112
```
114
113
115
114
To create an Aspire starter app, which is a full solution with a sample UI and backing API included:
116
115
117
-
```dotnetcli
118
-
dotnet new aspire-starter
116
+
```Aspire
117
+
aspire new aspire-starter
119
118
```
120
119
121
120
To create an Aspire app with a Python backend and JavaScript frontend:
122
121
123
-
```dotnetcli
124
-
dotnet new aspire-python
122
+
```Aspire
123
+
aspire new aspire-py-starter
125
124
```
126
125
127
126
> [!NOTE]
128
-
> The `aspire-python` template is currently under development. For more information, see [Build an Aspire app with Python and JavaScript](../get-started/build-aspire-python-app.md).
127
+
> The `aspire-py-starter` template is currently under development. For more information, see [Build an Aspire app with Python and JavaScript](../get-started/build-aspire-python-app.md).
129
128
130
129
> [!TIP]
131
130
> Aspire templates default to using the latest .NET version, even when using an earlier version of the .NET CLI. To manually specify the .NET version, use the `--framework <tfm>` option, for example to create a basic [Aspire AppHost](app-host-overview.md) project targeting .NET 8:
132
131
>
133
-
> ```dotnetcli
134
-
> dotnet new aspire-apphost --framework net8.0
132
+
> ```Aspire
133
+
> aspire new aspire-apphost --framework net8.0
135
134
> ```
136
135
137
136
You need to trust the ASP.NET Core :::no-loc text="localhost"::: certificate before running the app. Run the following command:
Copy file name to clipboardExpand all lines: docs/get-started/build-aspire-python-app.md
+43-40Lines changed: 43 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ ai-usage: ai-assisted
8
8
9
9
# Build an Aspire app with Python and JavaScript
10
10
11
-
In this article, you learn how to create a new Aspire application using the Aspire Python template. The template creates a solution with a Python backend (using FastAPI) and a JavaScript frontend (using React), orchestrated by Aspire. This approach is ideal for Python developers who want to build observable, production-ready applications with modern JavaScript frontends.
11
+
In this article, you learn how to create a new Aspire application using the Aspire Python template. The template creates a solution with a Python backend (using [FastAPI](https://fastapi.tiangolo.com/)) and a JavaScript frontend (using [React](https://react.dev/)), orchestrated by Aspire. This approach is ideal for Python developers who want to build observable, production-ready applications with modern JavaScript frontends.
12
12
13
13
> [!NOTE]
14
14
> The Aspire Python template is currently under development. This documentation will be updated as the template becomes available. For now, you can follow the guidance in [Orchestrate Python apps in Aspire](build-aspire-apps-with-python.md) to manually add Python applications to an existing Aspire solution.
@@ -45,20 +45,19 @@ To download Node.js (including `npm`), see the [Node.js download page](https://n
45
45
## Create an Aspire project using the Python template
46
46
47
47
> [!IMPORTANT]
48
-
> The `aspire-python` template is currently being developed and might not be available yet. Once released, you'll be able to create a Python-based Aspire application using the following command. For updates on template availability, see [Aspire Python Templates (issue #11865)](https://github.com/dotnet/aspire/issues/11865).
48
+
> The `aspire-py-starter` template is currently being developed and might not be available yet. Once released, you'll be able to create a Python-based Aspire application using the following command. For updates on template availability, see [Aspire Python Templates (issue #11865)](https://github.com/dotnet/aspire/issues/11865).
49
49
50
-
To create a new Aspire application with a Python backend and JavaScript frontend, use the `aspire-python` template:
50
+
To create a new Aspire application with a Python backend and JavaScript frontend, use the `aspire-py-starter` template:
51
51
52
-
```dotnetcli
53
-
dotnet new aspire-python -o MyPythonApp
52
+
```Aspire
53
+
aspire new aspire-py-starter
54
54
```
55
55
56
56
This command creates a new Aspire solution with the following structure:
57
57
58
-
-**MyPythonApp.AppHost**: An orchestrator project designed to connect and configure the different projects and services of your app.
59
-
-**MyPythonApp.ServiceDefaults**: A shared project to manage configurations that are reused across the projects in your solution related to resilience, service discovery, and telemetry.
60
-
-**MyPythonApp.Backend**: A Python backend using FastAPI framework.
61
-
-**MyPythonApp.Frontend**: A JavaScript frontend using React framework.
58
+
-**apphost.cs**: A file-based AppHost that orchestrates the Python backend and JavaScript frontend.
59
+
-**app**: A Python backend using [FastAPI](https://fastapi.tiangolo.com/) framework.
60
+
-**frontend**: A JavaScript frontend using [React](https://react.dev/) framework with Vite.
62
61
63
62
## Explore the project structure
64
63
@@ -68,33 +67,37 @@ Navigate to the newly created project directory:
68
67
cd MyPythonApp
69
68
```
70
69
71
-
### Python backend
70
+
### File-based AppHost
72
71
73
-
The Python backend is located in the _MyPythonApp.Backend_ directory. It uses the FastAPI framework to create RESTful APIs. The backend includes:
72
+
The solution uses a file-based AppHost with a single _apphost.cs_ file. This file contains the orchestration logic for both the Python backend and JavaScript frontend. The AppHost uses `AddPythonScript` to add the Python backend and `AddViteApp` to add the React frontend.
74
73
75
-
- A virtual environment for Python dependencies
76
-
- A _requirements.txt_ file listing required Python packages
77
-
- A _main.py_ file containing the FastAPI application code
78
-
- OpenTelemetry instrumentation for observability
74
+
### File-based AppHost
79
75
80
-
### JavaScript frontend
76
+
The solution uses a file-based AppHost with a single _apphost.cs_ file. This file contains the orchestration logic for both the Python backend and JavaScript frontend. The AppHost uses `AddPythonScript` to add the Python backend and `AddViteApp` to add the React frontend.
77
+
78
+
### Python backend
79
+
80
+
The Python backend is located in the _app_ directory. It uses the [FastAPI](https://fastapi.tiangolo.com/) framework to create RESTful APIs. The backend includes:
81
81
82
-
The JavaScript frontend is located in the _MyPythonApp.Frontend_ directory. It uses React to create the user interface. The frontend includes:
82
+
- A virtual environment for Python dependencies.
83
+
- A _requirements.txt_ file listing required Python packages.
84
+
- An _app.py_ file containing the FastAPI application code.
85
+
- OpenTelemetry instrumentation for observability.
83
86
84
-
- A _package.json_ file listing required npm packages
85
-
- Source code in the _src_ directory
86
-
- Configuration for connecting to the backend API
87
+
### JavaScript frontend
87
88
88
-
### AppHost orchestration
89
+
The JavaScript frontend is located in the _frontend_ directory. It uses [React](https://react.dev/) with Vite to create the user interface. The frontend includes:
89
90
90
-
The AppHost project (_MyPythonApp.AppHost_) orchestrates both the Python backend and JavaScript frontend. It uses the `AddPythonApp` and `AddNpmApp` APIs to configure and run these applications together.
91
+
- A _package.json_ file listing required npm packages.
92
+
- Source code in the _src_ directory.
93
+
- Configuration for connecting to the backend API.
0 commit comments