{"id":28706341,"url":"https://github.com/tkrisztian95/sample-python-flask-api-vscode-remote-dev","last_synced_at":"2026-04-24T21:31:22.053Z","repository":{"id":83779822,"uuid":"194748759","full_name":"tkrisztian95/sample-python-flask-api-vscode-remote-dev","owner":"tkrisztian95","description":"Dockerize your Development Environment with VS Code remote containers (Python)","archived":false,"fork":false,"pushed_at":"2020-04-28T20:56:44.000Z","size":39,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-14T15:43:04.330Z","etag":null,"topics":["devcontainer","example-project","flask","imdb","python","scraper","vscode"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tkrisztian95.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-07-01T22:03:31.000Z","updated_at":"2024-09-27T04:31:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"51c9b0a7-5a1a-4f61-a14e-212c6abbe394","html_url":"https://github.com/tkrisztian95/sample-python-flask-api-vscode-remote-dev","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tkrisztian95/sample-python-flask-api-vscode-remote-dev","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkrisztian95%2Fsample-python-flask-api-vscode-remote-dev","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkrisztian95%2Fsample-python-flask-api-vscode-remote-dev/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkrisztian95%2Fsample-python-flask-api-vscode-remote-dev/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkrisztian95%2Fsample-python-flask-api-vscode-remote-dev/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tkrisztian95","download_url":"https://codeload.github.com/tkrisztian95/sample-python-flask-api-vscode-remote-dev/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkrisztian95%2Fsample-python-flask-api-vscode-remote-dev/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32241549,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["devcontainer","example-project","flask","imdb","python","scraper","vscode"],"created_at":"2025-06-14T15:30:16.803Z","updated_at":"2026-04-24T21:31:22.048Z","avatar_url":"https://github.com/tkrisztian95.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Using VS Code remote development in Docker container (with Ptyhton \u0026 Flask)\r\nThe main purpose of this repo is to create a sample Python app and try making a consistent workflow locally for development. Visual Studio Code can do it so easily with just 1 plugin Remote Development with Docker containers. The steps can be altered for whatever the chosen environment required is. This also possible with WSL.\r\n\r\nMotivation:\r\nI would like to develop and run my Python code remotely/in a virtualized environment (similar to prod) without installing Python or any dev related packages/utils on my Windows machine. Instead, I just want to spin up a Python Docker container where I can find everything inside what I need.\r\n\r\nMain tasks I want to achieve:\r\n- [X] Setup remote Python development with Visual Studio Code\r\n- [X] Create some simple REST APIs with Flask to\r\n    - [X] return static index.html at `\"/\"`\r\n    - [X] return text \"Hello World\" under `\"/hello\"`\r\n    - [X] return Top 250 movies from IMDb at `\"/imdb/movies/top250\"`\r\n        - scrape [Imdb Top 250 movies](https://www.imdb.com/chart/top/?ref_=nv_mv_250) table from webpage with using [beautifulsoup4](https://www.crummy.com/software/BeautifulSoup/bs4/doc/#quick-start),\r\n        - parse into a class in \"/model/topMovie.py\"\r\n        - serialize objects and return as Json array \r\n        ```\r\n        {\r\n            \"results\": [\r\n            {\r\n                \"rank\": \"1.\",\r\n                \"rating\": \"9.2\",\r\n                \"title\": \"Die Verurteilten\"\r\n            },\r\n            ...\r\n        }\r\n        ```\r\n\r\n## Developing inside a Container\r\nThe Visual Studio Code Remote - Containers extension lets you use a Docker container as a full-featured development environment. \r\n[VS Code Remote guide](https://code.visualstudio.com/docs/remote/containers#_quick-start-open-a-folder-in-a-container)\r\n\r\n### Install Plugins\r\nWith the help of these plugins you can easily create and develop your Python code.\r\n\r\n1. [Python plugin for local edit](https://marketplace.visualstudio.com/items?itemName=ms-python.python) \r\n\r\n2. [Remote Containers plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)\r\n\r\n# How to setup \r\n0. In the root directory of your project, you need to create a folder called .devcontainer\r\n    - This is where we will store the settings for our environment.\r\n    - The naming is important!\r\n1. Under this .devcontainer folder:\r\n    - Create a devcontainer.json file (Hit F1 and select 'Remote-containers Create container configuration files') Basically a config file that determines how your dev container gets built and started.\r\n    - Create a docker-compose.yml [Sample](https://github.com/microsoft/python-sample-tweeterapp/blob/master/.devcontainer/docker-compose.yml) With this we can setup more complex environments and add additional services like databases etc.\r\n    - Create a Dockerfile [Sample](https://github.com/microsoft/python-sample-tweeterapp/blob/master/.devcontainer/Dockerfile) Within  we choose the image and we can add any RUN commands (such as global installs).\r\n## Python specific steps\r\n2. You can create a 'requirements.txt' or 'requirements.temp.txt' to define which Python dependencies needed to be installed for your app (E.g.: flask)\r\n    - For install requirements run this command inside the devcontainer: `pip install -r requirements.txt`\r\n3. Add some sample python code (app.py and static files) from [VS code try python](https://github.com/microsoft/vscode-remote-try-python)\r\n## Reopen workspace inside the devcontainer context\r\n4. Hit F1 and select 'Remote-Containers: Reopen Folder in Container'\r\n    - This will reopen VS Code and your workspace in a remote window, connected to the VS Code server which is running inside the container based on your Dockerfile.\r\n    - Once the container is running and you're connected, you should see your remote context change in the bottom left of the Status bar: \r\n    \r\n![Screenshot1](images/Capture.PNG)\r\n\r\n 5. Check your environment `python --version` and `pip list`\r\n    \r\n# Start the sample Python app and open it from the host\r\n7. For start the Python app we simply should  execute this command from the VS Code terminal: 'flask run'\r\n8. For make the APIs available from the host we first need to forward the ports from the container. \r\n    1. For this Hit F1 and select 'Forward a Port' \r\n        - In older versions 'Remote-Containers: Forward Port from Container'\r\n    2. Enter port number 5000.\r\n9. Open your browser and navigate to `localhost:5000`\r\n    - (In older versions Click \"Open Browser\" in the notification that appears to access the web app on this new port.)\r\n\r\n\r\nNotes:\r\n- Files added/created at the workspace in the host outside the devcontainer context not gonna appear. You need to rebuild the devcontainer. Hit F1 then select option \"Remote-Containers: Rebuild Container\"\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkrisztian95%2Fsample-python-flask-api-vscode-remote-dev","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftkrisztian95%2Fsample-python-flask-api-vscode-remote-dev","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkrisztian95%2Fsample-python-flask-api-vscode-remote-dev/lists"}