mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
docs
This commit is contained in:
@@ -59,6 +59,39 @@ For instance, the following will run the `textual colors` command:
|
||||
textual run -c textual colors
|
||||
```
|
||||
|
||||
### Serve
|
||||
|
||||
The devtools can also serve your application in a browser.
|
||||
Effectively turning your terminal app in to a web application!
|
||||
|
||||
The `serve` sub-command is similar to `run`. Here's how you can serve an app launched from a Python file:
|
||||
|
||||
```
|
||||
textual serve my_app.py
|
||||
```
|
||||
|
||||
You can also serve a Textual app launched via a command. Here's an example:
|
||||
|
||||
```
|
||||
textual serve "textual keys"
|
||||
```
|
||||
|
||||
The syntax for launching an app in a module is slightly different from `run`.
|
||||
You need to specify the full command, including `python`.
|
||||
Here's how you would run the Textual demo:
|
||||
|
||||
```
|
||||
textual serve "python -m textual"
|
||||
```
|
||||
|
||||
Textual's builtin web-server is quite powerful.
|
||||
You can serve multiple instances of your application at once!
|
||||
|
||||
!!! tip
|
||||
|
||||
Textual serve is also useful when developing your app.
|
||||
If you make changes to your code, simply refresh the browser to update.
|
||||
|
||||
## Live editing
|
||||
|
||||
If you combine the `run` command with the `--dev` switch your app will run in *development mode*.
|
||||
|
||||
Reference in New Issue
Block a user