Rev python example
This commit is contained in:
		@@ -1,6 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
	"name": "Python Sample",
 | 
			
		||||
	"dockerFile": "Dockerfile",
 | 
			
		||||
	"appPort": 9000,
 | 
			
		||||
	"context": "..",
 | 
			
		||||
	"extensions": [
 | 
			
		||||
		"ms-python.python",
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							@@ -5,10 +5,10 @@
 | 
			
		||||
    "version": "0.2.0",
 | 
			
		||||
    "configurations": [
 | 
			
		||||
        {
 | 
			
		||||
            "name": "Python: Current File (Integrated Terminal)",
 | 
			
		||||
            "name": "Launch Server",
 | 
			
		||||
            "type": "python",
 | 
			
		||||
            "request": "launch",
 | 
			
		||||
            "program": "${file}",
 | 
			
		||||
            "program": "${workspaceFolder}/server.py",
 | 
			
		||||
            "console": "integratedTerminal"
 | 
			
		||||
        }
 | 
			
		||||
    ]
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										52
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										52
									
								
								README.md
									
									
									
									
									
								
							@@ -1,20 +1,48 @@
 | 
			
		||||
# Python Sample Project for Visual Studio Remote - Containers
 | 
			
		||||
# Try Out Development Containers: Python
 | 
			
		||||
 | 
			
		||||
This is a sample project to go along with the "try" quick start for the VS Code Remote - Containers extension.
 | 
			
		||||
This is a sample project to go along with the "try" quick start for the **[VS Code Remote - Containers](https://aka.ms/vscode-remote/containers)** extension.
 | 
			
		||||
 | 
			
		||||
Using the sample:
 | 
			
		||||
**If you aren't already following the quick start, [see here](#setting-up-the-development-container).**
 | 
			
		||||
 | 
			
		||||
1. **[Windows]** Disable automatic line ending conversion for Git on the *Windows side* (given Linux and Windows use different line endings). Run: `git config --global core.autocrlf false`
 | 
			
		||||
2. Follow the steps at [https://aka.ms/vscode-remote/containers/getting-started](https://aka.ms/vscode-remote/containers/getting-started).
 | 
			
		||||
3. Open `hello.py`, launch the program, edit, and try things out!
 | 
			
		||||
## Things to try
 | 
			
		||||
 | 
			
		||||
One you have this sample opened in a container, you'll be able to work with it like you would locally. 
 | 
			
		||||
 | 
			
		||||
Some things to try:
 | 
			
		||||
 | 
			
		||||
1. **Edit:**
 | 
			
		||||
   1. Open `server.py`
 | 
			
		||||
   2. Try adding some code and check out the language features.
 | 
			
		||||
2. **Terminal:** Press <kbd>ctrl</kbd>+<kbd>shift</kbd>+<kbd>\`</kbd> and type `uname` and or other Linux commands from the terminal window.
 | 
			
		||||
2. **Build, Run, and Debug:**
 | 
			
		||||
   1. Open `sever.py`
 | 
			
		||||
   2. Add a breakpoint.
 | 
			
		||||
   3. Press <kbd>F5</kbd> to launch the app in the container.
 | 
			
		||||
   4. Open a local browser and go to `http://localhost:9000` and note you can connect to the server in the container.
 | 
			
		||||
   5. Once the breakpoint is hit, try hovering over variables, examining locals, and more.
 | 
			
		||||
3. **Forward another port:**
 | 
			
		||||
   1. Stop debugging
 | 
			
		||||
   2. Open `sever.py`
 | 
			
		||||
   3. Change the server port to 5000. (`PORT = 5000`)
 | 
			
		||||
   4. Press <kbd>F5</kbd> to launch the app in the container.
 | 
			
		||||
   5. Press <kbd>F1</kbd> and run the **Remote-Containers: Forward Port...** command.
 | 
			
		||||
   6. Select port 5000.
 | 
			
		||||
   7. Click "Open Browser" in the notification that appears to access the web app on this new port.
 | 
			
		||||
 | 
			
		||||
## Setting up the development container
 | 
			
		||||
 | 
			
		||||
Follow these steps to open this sample in a container:
 | 
			
		||||
 | 
			
		||||
1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to get set up.
 | 
			
		||||
 | 
			
		||||
2. If you're not yet in a development container:
 | 
			
		||||
   1. Clone this repository.
 | 
			
		||||
   2. Press <kbd>F1</kbd> and select the **Remote-Container: Open Folder in Container...** command.
 | 
			
		||||
   3. Select the cloned copy of this folder, wait for the container to start, and try things out!
 | 
			
		||||
 | 
			
		||||
### More samples
 | 
			
		||||
 | 
			
		||||
Other samples and dev container definitions:
 | 
			
		||||
- [Tweeter App - Python and Django](https://github.com/Microsoft/python-sample-tweeterapp)
 | 
			
		||||
- Dev container definitions with sample content
 | 
			
		||||
    - [Python 3](https://github.com/Microsoft/vscode-dev-containers/tree/master/containers/python-3)
 | 
			
		||||
    - [Python 3 - Anaconda](https://github.com/Microsoft/vscode-dev-containers/tree/master/containers/python-3-anaconda)
 | 
			
		||||
    - [Python 3 - Miniconda](https://github.com/Microsoft/vscode-dev-containers/tree/master/containers/python-3-miniconda)
 | 
			
		||||
    - [Python 3 & Posgres](https://github.com/Microsoft/vscode-dev-containers/tree/master/containers/python-3-posgres)
 | 
			
		||||
 | 
			
		||||
## Contributing
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										9
									
								
								index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								index.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
<html>
 | 
			
		||||
    <head>
 | 
			
		||||
        <title>VS Code Rocks!</title>
 | 
			
		||||
    </head>
 | 
			
		||||
    <body>
 | 
			
		||||
        <h1>VS Code can do that?</h1>
 | 
			
		||||
        <p>Yes it can!</p>
 | 
			
		||||
    </body>
 | 
			
		||||
</html>
 | 
			
		||||
@@ -3,4 +3,13 @@
 | 
			
		||||
# Licensed under the MIT License. See LICENSE in the project root for license information.
 | 
			
		||||
#-----------------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
print('Hello, remote world!')
 | 
			
		||||
import socketserver
 | 
			
		||||
import http.server
 | 
			
		||||
 | 
			
		||||
RequestHandler = http.server.SimpleHTTPRequestHandler
 | 
			
		||||
 | 
			
		||||
PORT = 5000
 | 
			
		||||
 | 
			
		||||
with socketserver.TCPServer(("", PORT), RequestHandler) as httpd:
 | 
			
		||||
    print("Server runnong on port", PORT)
 | 
			
		||||
    httpd.serve_forever()
 | 
			
		||||
		Reference in New Issue
	
	Block a user