Update README.md

This commit is contained in:
Chuck Lantz
2020-03-31 12:25:50 -07:00
committed by GitHub
parent d1e170119e
commit 27da2b3449

View File

@@ -33,17 +33,21 @@ Some things to try:
1. **Edit:** 1. **Edit:**
- Open `app.py` - Open `app.py`
- Try adding some code and check out the language features. - Try adding some code and check out the language features.
2. **Terminal:** 2. **Terminal:**
- Press <kbd>ctrl</kbd>+<kbd>shift</kbd>+<kbd>\`</kbd> to open a terminal window. - Press <kbd>ctrl</kbd>+<kbd>shift</kbd>+<kbd>\`</kbd> to open a terminal window.
- Type `python -m flask run --port 9000 --no-debugger --no-reload` to run the app. - Type `python -m flask run --port 9000 --no-debugger --no-reload` to run the app.
- Open a local browser and go to `http://localhost:9000` to see the running app. - Open a local browser and go to `http://localhost:9000` to see the running app.
> **Tip:** If you use this container outside of VS Code via `docker run` with `-p 9000`, you may need to append `--host 0.0.0.0` to the command above. The `-p` option "publishes" the port rather than forwarding it. It therefore will not work if the application only listens to localhost. The `forwardPorts` property in `devcontainer.json` does not have this limitation, but you can use `appPort` to publish instead if you prefer.
> **Tip:** If you use this container outside of VS Code via `docker run` with `-p 9000`, you may need to append `--host 0.0.0.0` to the command above. The `-p` option "publishes" the port rather than forwarding it. It therefore will not work if the application only listens to localhost. The `forwardPorts` property in `devcontainer.json` does not have this limitation, but you can use `appPort` property instead if you want to mirror the `docker run` behavior.
3. **Build, Run, and Debug:** 3. **Build, Run, and Debug:**
- Open `app.py` - Open `app.py`
- Add a breakpoint (e.g. on line 9). - Add a breakpoint (e.g. on line 9).
- Press <kbd>F5</kbd> to launch the app in the container. - Press <kbd>F5</kbd> to launch the app in the container.
- Once the breakpoint is hit, try hovering over variables (e.g. the app variable on line 7), examining locals, and more. - Once the breakpoint is hit, try hovering over variables (e.g. the app variable on line 7), examining locals, and more.
- Continue, then open a local browser and go to `http://localhost:9000` and note you can connect to the server in the container - Continue, then open a local browser and go to `http://localhost:9000` and note you can connect to the server in the container
4. **Forward another port:** 4. **Forward another port:**
- Stop debugging and remove the breakpoint. - Stop debugging and remove the breakpoint.
- Open `.vscode/launch.json` - Open `.vscode/launch.json`
@@ -52,9 +56,9 @@ Some things to try:
- Press <kbd>F1</kbd> and run the **Forward a Port** command. - Press <kbd>F1</kbd> and run the **Forward a Port** command.
- Select port 5000. - Select port 5000.
- Click "Open Browser" in the notification that appears to access the web app on this new port. - Click "Open Browser" in the notification that appears to access the web app on this new port.
5. **Run from the command line** 5. **Run from the command line**
- Press <kbd>ctrl</kbd>+<kbd>shift</kbd>+<kbd>\`</kbd> to open a terminal window - Press <kbd>ctrl</kbd>+<kbd>shift</kbd>+<kbd>\`</kbd> to open a terminal window
### More samples ### More samples