From 15f009295928cc3fa17666104e36b93a4db03e9d Mon Sep 17 00:00:00 2001 From: Kraig Brockschmidt Date: Tue, 23 Oct 2018 10:17:32 -0700 Subject: [PATCH 01/24] Tweak quotes --- hello_app/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hello_app/views.py b/hello_app/views.py index 91807bbf9..d40756488 100644 --- a/hello_app/views.py +++ b/hello_app/views.py @@ -24,4 +24,4 @@ def hello_there(name): @app.route("/api/data") def get_data(): - return app.send_static_file('data.json') + return app.send_static_file("data.json") From 6e109b0158fa2467367e5852cfc218c187c2caf5 Mon Sep 17 00:00:00 2001 From: Juhi Bhatnagar Date: Wed, 24 Oct 2018 10:30:51 -0500 Subject: [PATCH 02/24] Added documentation to __init__.py --- hello_app/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hello_app/__init__.py b/hello_app/__init__.py index cf1f4140e..eb82cbf69 100644 --- a/hello_app/__init__.py +++ b/hello_app/__init__.py @@ -1,2 +1,2 @@ -from flask import Flask -app = Flask(__name__) +from flask import Flask # Import the Flask class +app = Flask(__name__) # Create an instance of the class for our use From 6fae7f5aa43b13111e0b856c04d83e08a5c14d12 Mon Sep 17 00:00:00 2001 From: Richa Agrawal Date: Sat, 27 Oct 2018 02:07:53 +0530 Subject: [PATCH 03/24] Added headings --- README.md | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 301c7ea4e..07d8757c2 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,20 @@ -This sample contains the completed program from the tutorial, [Using Flask in Visual Studio Code](https://code.visualstudio.com/docs/python/tutorial-flask). Intermediate steps are not included. - -It also contains the Dockerfile and uwsgi.ini files necessary to build a container with a production server. The resulting image works both locally and when deployed to Azure App Service. See [Deploy Python using Docker containers](https://code.visualstudio.com/docs/python/tutorial-deploy-containers). +# Python Sample VSCode Flask Tutorial +## About This +* This sample contains the completed program from the tutorial, make sure to visit the link: [Using Flask in Visual Studio Code](https://code.visualstudio.com/docs/python/tutorial-flask). Intermediate steps are not included. +* It also contains the Dockerfile and uwsgi.ini files necessary to build a container with a production server. The resulting image works both locally and when deployed to Azure App Service. See [Deploy Python using Docker containers](https://code.visualstudio.com/docs/python/tutorial-deploy-containers). +## Navigation The `startup.py` file, for its part, is specifically for deploying to Azure App Service on Linux without containers. Because the app code is in its own *module* in the `hello_app` folder (which has an `__init__.py`), trying to start the Gunicorn server within App Service on Linux produces an "Attempted relative import in non-package" error. The `startup.py` file, therefore, is just a shim to import the app object from the `hello_app` module, which then allows you to use startup:app in the Gunicorn command line (see `startup.txt`). +## Important to contributors Contributions to the sample are welcome. When submitting changes, also consider submitting matching changes to the tutorial, the source file for which is [tutorial-flask.md](https://github.com/Microsoft/vscode-docs/blob/master/docs/python/tutorial-flask.md). -# Contributing - -This project welcomes contributions and suggestions. Most contributions require you to agree to a -Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us -the rights to use your contribution. For details, visit https://cla.microsoft.com. +## Contributing +* This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com. -When you submit a pull request, a CLA-bot will automatically determine whether you need to provide -a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions -provided by the bot. You will only need to do this once across all repos using our CLA. +* When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). -For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or -contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. +## Some more Details +* This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +* For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or +* Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. From e7bd6e86a699e4f8ac903dfa658d5ae4ec0c15ee Mon Sep 17 00:00:00 2001 From: Harsh Sahu <42430373+codehawkdevs@users.noreply.github.com> Date: Sat, 27 Oct 2018 12:56:36 +0530 Subject: [PATCH 04/24] Update startup.py removed single line comments and added multiline comments which makes code more readable. --- startup.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/startup.py b/startup.py index 3c7d57d05..9fa523781 100644 --- a/startup.py +++ b/startup.py @@ -1,10 +1,12 @@ -# In this sample, the Flask app object is contained within the hello_app *module*; -# that is, hello_app contains an __init__.py along with relative imports. Because -# of this structure, a file like webapp.py cannot be run directly as the startup -# file through Gunicorn; the result is "Attempted relative import in non-package". -# -# The solution is to provide a simple alternate startup file, like this present -# startup.py, that just imports the app object. You can then just specify -# startup:app in the Gunicorn command. +""" +In this sample, the Flask app object is contained within the hello_app *module*; +that is, hello_app contains an __init__.py along with relative imports. Because +of this structure, a file like webapp.py cannot be run directly as the startup +file through Gunicorn; the result is "Attempted relative import in non-package". + +The solution is to provide a simple alternate startup file, like this present +startup.py, that just imports the app object. You can then just specify +startup:app in the Gunicorn command. +""" from hello_app.webapp import app From 0610693a184c6144717946217f26fb2699b0f709 Mon Sep 17 00:00:00 2001 From: yashsahugtx <44510708+yashsahugtx@users.noreply.github.com> Date: Sat, 27 Oct 2018 13:54:21 +0530 Subject: [PATCH 05/24] removed multi line comment --- hello_app/webapp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hello_app/webapp.py b/hello_app/webapp.py index c76b9bcb3..56386def8 100644 --- a/hello_app/webapp.py +++ b/hello_app/webapp.py @@ -1,4 +1,4 @@ -"""Entry point for the application.""" +# Entry point for the application. from . import app # For application discovery by the 'flask' command. from . import views # For import side-effects of setting up routes. From 03bc2fdde9e2650098e9b36a02da309f5c507cb7 Mon Sep 17 00:00:00 2001 From: Mukesh Jha Date: Sat, 27 Oct 2018 16:06:06 +0530 Subject: [PATCH 06/24] Added the documentation link of Jinja --- hello_app/templates/hello_there.html | 1 + 1 file changed, 1 insertion(+) diff --git a/hello_app/templates/hello_there.html b/hello_app/templates/hello_there.html index 7c54f6437..dba83deea 100644 --- a/hello_app/templates/hello_there.html +++ b/hello_app/templates/hello_there.html @@ -9,3 +9,4 @@ Hello there, {{ name }}! It's {{ date.strftime("%A, %d %B, %Y at %X") }}. + From 9eb79f40e28bf53f02a8a5afa62139b33c70648e Mon Sep 17 00:00:00 2001 From: Kraig Brockschmidt Date: Wed, 28 Nov 2018 16:57:04 -0800 Subject: [PATCH 07/24] Small edits --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 07d8757c2..d07d6d8ed 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,22 @@ -# Python Sample VSCode Flask Tutorial -## About This +# Python/Flask tutorial sample for Visual Studio Code + * This sample contains the completed program from the tutorial, make sure to visit the link: [Using Flask in Visual Studio Code](https://code.visualstudio.com/docs/python/tutorial-flask). Intermediate steps are not included. * It also contains the Dockerfile and uwsgi.ini files necessary to build a container with a production server. The resulting image works both locally and when deployed to Azure App Service. See [Deploy Python using Docker containers](https://code.visualstudio.com/docs/python/tutorial-deploy-containers). ## Navigation + The `startup.py` file, for its part, is specifically for deploying to Azure App Service on Linux without containers. Because the app code is in its own *module* in the `hello_app` folder (which has an `__init__.py`), trying to start the Gunicorn server within App Service on Linux produces an "Attempted relative import in non-package" error. The `startup.py` file, therefore, is just a shim to import the app object from the `hello_app` module, which then allows you to use startup:app in the Gunicorn command line (see `startup.txt`). -## Important to contributors +## Contributing + Contributions to the sample are welcome. When submitting changes, also consider submitting matching changes to the tutorial, the source file for which is [tutorial-flask.md](https://github.com/Microsoft/vscode-docs/blob/master/docs/python/tutorial-flask.md). -## Contributing -* This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com. +Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com. + +When you submit a pull request, a CLA-bot automatically determines whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. -* When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. +## Additional details -## Some more Details * This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). * For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or * Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. From 3546f388b587af3e1e4c03bda95f52cbe229131d Mon Sep 17 00:00:00 2001 From: Tim Preble Date: Sat, 29 Dec 2018 15:04:51 -0500 Subject: [PATCH 08/24] Update views.py adding in option for hello route so that "Name" is not required. --- hello_app/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hello_app/views.py b/hello_app/views.py index d40756488..688bb0dfc 100644 --- a/hello_app/views.py +++ b/hello_app/views.py @@ -14,8 +14,9 @@ def about(): def contact(): return render_template("contact.html") +@app.route("/hello") @app.route("/hello/") -def hello_there(name): +def hello_there(name = None): return render_template( "hello_there.html", name=name, From 459347af18d576200683505df00cc5a2927d8f67 Mon Sep 17 00:00:00 2001 From: Tim Preble Date: Sat, 29 Dec 2018 15:06:23 -0500 Subject: [PATCH 09/24] Update hello_there.html Added in logic so that "Name" is not required. If name is not supplied then a message is displayed. --- hello_app/templates/hello_there.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hello_app/templates/hello_there.html b/hello_app/templates/hello_there.html index dba83deea..f20eb8d93 100644 --- a/hello_app/templates/hello_there.html +++ b/hello_app/templates/hello_there.html @@ -6,7 +6,11 @@ Hello, Flask - Hello there, {{ name }}! It's {{ date.strftime("%A, %d %B, %Y at %X") }}. + {%if name %} + Hello there, {{ name }}! It's {{ date.strftime("%A, %d %B, %Y at %X") }}. + {% else %} + You must provide a name. + {% endif %} From 750939f3de2ec681884ea403ec35def770dff312 Mon Sep 17 00:00:00 2001 From: Kraig Brockschmidt Date: Fri, 11 Jan 2019 15:27:52 -0800 Subject: [PATCH 10/24] Change no-name message to be a little friendlier. --- hello_app/templates/hello_there.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hello_app/templates/hello_there.html b/hello_app/templates/hello_there.html index f20eb8d93..de1ef49d1 100644 --- a/hello_app/templates/hello_there.html +++ b/hello_app/templates/hello_there.html @@ -9,7 +9,7 @@ {%if name %} Hello there, {{ name }}! It's {{ date.strftime("%A, %d %B, %Y at %X") }}. {% else %} - You must provide a name. + What's your name? Provide it after /hello/ in the URL. {% endif %} From 4fc1bc5cb35715baac58177271e04493f947c4a3 Mon Sep 17 00:00:00 2001 From: Kraig Brockschmidt Date: Thu, 7 Feb 2019 11:47:40 -0800 Subject: [PATCH 11/24] Add / to routes https://github.com/Microsoft/vscode-docs/issues/2371 --- hello_app/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hello_app/views.py b/hello_app/views.py index 688bb0dfc..8f714ea90 100644 --- a/hello_app/views.py +++ b/hello_app/views.py @@ -6,15 +6,15 @@ def home(): return render_template("home.html") -@app.route("/about") +@app.route("/about/") def about(): return render_template("about.html") -@app.route("/contact") +@app.route("/contact/") def contact(): return render_template("contact.html") -@app.route("/hello") +@app.route("/hello/") @app.route("/hello/") def hello_there(name = None): return render_template( From d39571369734dc4bce6ce5f60bc9e1baaf4586cd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2019 16:32:00 +0000 Subject: [PATCH 12/24] Bump werkzeug from 0.14.1 to 0.15.3 Bumps [werkzeug](https://github.com/pallets/werkzeug) from 0.14.1 to 0.15.3. - [Release notes](https://github.com/pallets/werkzeug/releases) - [Changelog](https://github.com/pallets/werkzeug/blob/master/CHANGES.rst) - [Commits](https://github.com/pallets/werkzeug/compare/0.14.1...0.15.3) Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 34ffbb7b2..012c5f6ee 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,4 @@ Flask==1.0.2 itsdangerous==0.24 Jinja2==2.10 MarkupSafe==1.0 -Werkzeug==0.14.1 +Werkzeug==0.15.3 From 91f904bad90dfb0fe347aa34287290c06802f0c6 Mon Sep 17 00:00:00 2001 From: FEYgHUB Date: Sun, 16 Feb 2020 13:01:18 -0700 Subject: [PATCH 13/24] Create test_test1.py --- test_test1.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 test_test1.py diff --git a/test_test1.py b/test_test1.py new file mode 100644 index 000000000..df1dc6821 --- /dev/null +++ b/test_test1.py @@ -0,0 +1 @@ +print('Hello World') From 944f388614bd20e5dabfa5ba8b03cecd5c3e2721 Mon Sep 17 00:00:00 2001 From: Jarno Lintusaari Date: Fri, 15 May 2020 12:25:51 +0300 Subject: [PATCH 14/24] Update test_test1.py Without an actual test, the `pytest` will return: `##[error]Bash exited with code '5'.` --- test_test1.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test_test1.py b/test_test1.py index df1dc6821..da8dc03d2 100644 --- a/test_test1.py +++ b/test_test1.py @@ -1 +1,2 @@ -print('Hello World') +def test_mock(): + assert True From b1c29ef1f44cfa3214a07bbc79b6ccfa72ad5fb0 Mon Sep 17 00:00:00 2001 From: halderex <66224013+halderex@users.noreply.github.com> Date: Tue, 23 Jun 2020 14:43:58 +0200 Subject: [PATCH 15/24] Updated Werkzeug to 0.15.5 to resolve issue #27 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 012c5f6ee..77bc281e9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,4 @@ Flask==1.0.2 itsdangerous==0.24 Jinja2==2.10 MarkupSafe==1.0 -Werkzeug==0.15.3 +Werkzeug==0.15.5 From 4287ca848a49017b2c46597bfc048cff8cc5bb73 Mon Sep 17 00:00:00 2001 From: Kraig Brockschmidt Date: Wed, 22 Jul 2020 15:10:10 -0700 Subject: [PATCH 16/24] Update Jinga version ref per dependabot --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 77bc281e9..af2376e97 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ click==6.7 Flask==1.0.2 itsdangerous==0.24 -Jinja2==2.10 +Jinja2>=2.10.1 MarkupSafe==1.0 Werkzeug==0.15.5 From abf28e1c762f40a0dae77290609dd12194f0d5f5 Mon Sep 17 00:00:00 2001 From: Uche Nkadi Date: Wed, 26 Aug 2020 14:33:07 -0700 Subject: [PATCH 17/24] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d07d6d8ed..319b556d1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Python/Flask tutorial sample for Visual Studio Code +# Python/Flask Tutorial for Visual Studio Code * This sample contains the completed program from the tutorial, make sure to visit the link: [Using Flask in Visual Studio Code](https://code.visualstudio.com/docs/python/tutorial-flask). Intermediate steps are not included. * It also contains the Dockerfile and uwsgi.ini files necessary to build a container with a production server. The resulting image works both locally and when deployed to Azure App Service. See [Deploy Python using Docker containers](https://code.visualstudio.com/docs/python/tutorial-deploy-containers). From 2ae3a94bd05043561c3b07ccfe84345c1aee2d4a Mon Sep 17 00:00:00 2001 From: Kraig Brockschmidt Date: Mon, 26 Oct 2020 11:16:24 -0700 Subject: [PATCH 18/24] Simplify requirements and update readme --- README.md | 1 + requirements.txt | 7 +------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 319b556d1..fe8285f23 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Python/Flask Tutorial for Visual Studio Code * This sample contains the completed program from the tutorial, make sure to visit the link: [Using Flask in Visual Studio Code](https://code.visualstudio.com/docs/python/tutorial-flask). Intermediate steps are not included. +* To run the app, first run use `set FLASK_APP=hello_app:app` (Windows cmd) or `FLASK_APP=hello_app:app` (macOS/Linux). * It also contains the Dockerfile and uwsgi.ini files necessary to build a container with a production server. The resulting image works both locally and when deployed to Azure App Service. See [Deploy Python using Docker containers](https://code.visualstudio.com/docs/python/tutorial-deploy-containers). ## Navigation diff --git a/requirements.txt b/requirements.txt index af2376e97..e3e9a71d9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1 @@ -click==6.7 -Flask==1.0.2 -itsdangerous==0.24 -Jinja2>=2.10.1 -MarkupSafe==1.0 -Werkzeug==0.15.5 +Flask From 709cdb91354d9c5a34cdb116c18dffa84c44c5f8 Mon Sep 17 00:00:00 2001 From: Kraig Brockschmidt Date: Mon, 26 Oct 2020 11:19:44 -0700 Subject: [PATCH 19/24] Update readme --- README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fe8285f23..1d9d39a3d 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,19 @@ # Python/Flask Tutorial for Visual Studio Code * This sample contains the completed program from the tutorial, make sure to visit the link: [Using Flask in Visual Studio Code](https://code.visualstudio.com/docs/python/tutorial-flask). Intermediate steps are not included. -* To run the app, first run use `set FLASK_APP=hello_app:app` (Windows cmd) or `FLASK_APP=hello_app:app` (macOS/Linux). * It also contains the Dockerfile and uwsgi.ini files necessary to build a container with a production server. The resulting image works both locally and when deployed to Azure App Service. See [Deploy Python using Docker containers](https://code.visualstudio.com/docs/python/tutorial-deploy-containers). +* To run the app: + 1. Run the command `cd hello_app`, which is the folder that contains the Flask app. + 1. Run the command `set FLASK_APP=webapp` (Windows cmd) or `FLASK_APP=webapp` (macOS/Linux) to point to the app module. + 1. Start the Flask server with `flask run`. -## Navigation +## The startup.py file -The `startup.py` file, for its part, is specifically for deploying to Azure App Service on Linux without containers. Because the app code is in its own *module* in the `hello_app` folder (which has an `__init__.py`), trying to start the Gunicorn server within App Service on Linux produces an "Attempted relative import in non-package" error. The `startup.py` file, therefore, is just a shim to import the app object from the `hello_app` module, which then allows you to use startup:app in the Gunicorn command line (see `startup.txt`). +In the root folder, the `startup.py` file is specifically for deploying to Azure App Service on Linux without using a containerized version of the app (that is, deploying the code directly, not as a container). + +Because the app code is in its own *module* in the `hello_app` folder (which has an `__init__.py`), trying to start the Gunicorn server within App Service on Linux produces an "Attempted relative import in non-package" error. + +The `startup.py` file, therefore, is a shim to import the app object from the `hello_app` module, which then allows you to use startup:app in the Gunicorn command line (see `startup.txt`). ## Contributing From 9115126c9ae00bdfcfa2f8b4c1a25d31f23b3dde Mon Sep 17 00:00:00 2001 From: Kraig Brockschmidt Date: Mon, 26 Oct 2020 11:21:17 -0700 Subject: [PATCH 20/24] Update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1d9d39a3d..bc29ab4b3 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ * This sample contains the completed program from the tutorial, make sure to visit the link: [Using Flask in Visual Studio Code](https://code.visualstudio.com/docs/python/tutorial-flask). Intermediate steps are not included. * It also contains the Dockerfile and uwsgi.ini files necessary to build a container with a production server. The resulting image works both locally and when deployed to Azure App Service. See [Deploy Python using Docker containers](https://code.visualstudio.com/docs/python/tutorial-deploy-containers). * To run the app: - 1. Run the command `cd hello_app`, which is the folder that contains the Flask app. + 1. Run the command `cd hello_app`, to change into the folder that contains the Flask app. 1. Run the command `set FLASK_APP=webapp` (Windows cmd) or `FLASK_APP=webapp` (macOS/Linux) to point to the app module. 1. Start the Flask server with `flask run`. From 7ccaebe63244e8b86fbf64a863f8406b3e65b86b Mon Sep 17 00:00:00 2001 From: Kraig Brockschmidt Date: Fri, 20 Nov 2020 12:24:47 -0700 Subject: [PATCH 21/24] Update README.md --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bc29ab4b3..068a76fd5 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ # Python/Flask Tutorial for Visual Studio Code * This sample contains the completed program from the tutorial, make sure to visit the link: [Using Flask in Visual Studio Code](https://code.visualstudio.com/docs/python/tutorial-flask). Intermediate steps are not included. -* It also contains the Dockerfile and uwsgi.ini files necessary to build a container with a production server. The resulting image works both locally and when deployed to Azure App Service. See [Deploy Python using Docker containers](https://code.visualstudio.com/docs/python/tutorial-deploy-containers). -* To run the app: + +* It also contains the *Dockerfile* and *uwsgi.ini* files necessary to build a container with a production server. The resulting image works both locally and when deployed to Azure App Service. See [Deploy Python using Docker containers](https://code.visualstudio.com/docs/python/tutorial-deploy-containers). + +* To run the app locally: 1. Run the command `cd hello_app`, to change into the folder that contains the Flask app. 1. Run the command `set FLASK_APP=webapp` (Windows cmd) or `FLASK_APP=webapp` (macOS/Linux) to point to the app module. 1. Start the Flask server with `flask run`. From c49c02d17ce0631f4fc1e1d87f4de69deca3ec26 Mon Sep 17 00:00:00 2001 From: Anthony Shaw Date: Wed, 17 Feb 2021 11:06:48 +1100 Subject: [PATCH 22/24] Update Dockerfile (#42) --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 0f62521f9..4c775f6b9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Pull a pre-built alpine docker image with nginx and python3 installed -FROM tiangolo/uwsgi-nginx-flask:python3.6-alpine3.7 +FROM tiangolo/uwsgi-nginx:python3.8-alpine-2020-12-19 # Set the port on which the app runs; make both values the same. # From 06acc6a271168fe67f8f4b015739792444e8b645 Mon Sep 17 00:00:00 2001 From: "microsoft-github-policy-service[bot]" <77245923+microsoft-github-policy-service[bot]@users.noreply.github.com> Date: Tue, 30 Aug 2022 09:37:23 +0000 Subject: [PATCH 23/24] Microsoft mandatory file --- SECURITY.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 000000000..869fdfe2b --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,41 @@ + + +## Security + +Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). + +If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. + +## Reporting Security Issues + +**Please do not report security vulnerabilities through public GitHub issues.** + +Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). + +If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). + +You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). + +Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: + + * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) + * Full paths of source file(s) related to the manifestation of the issue + * The location of the affected source code (tag/branch/commit or direct URL) + * Any special configuration required to reproduce the issue + * Step-by-step instructions to reproduce the issue + * Proof-of-concept or exploit code (if possible) + * Impact of the issue, including how an attacker might exploit the issue + +This information will help us triage your report more quickly. + +If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. + +## Preferred Languages + +We prefer all communications to be in English. + +## Policy + +Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). + + From 0e4d14ec6327539fd1a4ab0075778c25485a69e0 Mon Sep 17 00:00:00 2001 From: Courtney Webster <60238438+cwebster-99@users.noreply.github.com> Date: Tue, 27 Feb 2024 15:46:56 -0600 Subject: [PATCH 24/24] Adding dev container and updating configs (#95) * Adding dec container and updating configs * Update .devcontainer/devcontainer.json --- .devcontainer/devcontainer.json | 32 +++++++++ .github/dependabot.yml | 12 ++++ .vscode/launch.json | 114 ++------------------------------ 3 files changed, 51 insertions(+), 107 deletions(-) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .github/dependabot.yml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..8e52ba28f --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,32 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/python +{ + "name": "Python VS Code Flask Tutorial", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye", + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "pip3 install --user -r requirements.txt", + + // Configure tool-specific properties. + "customizations": { + "vscode": { + "extensions": [ + "ms-python.python", + "ms-python.black-formatter", + "ms-python.vscode-pylance", + "charliermarsh.ruff", + "ms-python.debugpy" + ] + } + } + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..f33a02cd1 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for more information: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +# https://containers.dev/guide/dependabot + +version: 2 +updates: + - package-ecosystem: "devcontainers" + directory: "/" + schedule: + interval: weekly diff --git a/.vscode/launch.json b/.vscode/launch.json index d3e8cf2e6..9a2737d78 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,121 +5,21 @@ "version": "0.2.0", "configurations": [ { - "name": "Python: runserver.py", - "type": "python", - "request": "launch", - "program": "${workspaceFolder}/runserver.py", - }, - { - "name": "Python: Current File", - "type": "python", - "request": "launch", - "program": "${file}", - "env": { - "FLASK_ENV": "development" - } - }, - { - "name": "Python: Attach", - "type": "python", - "request": "attach", - "localRoot": "${workspaceFolder}", - "remoteRoot": "${workspaceFolder}", - "port": 3000, - "secret": "my_secret", - "host": "localhost" - }, - { - "name": "Python: Terminal (integrated)", - "type": "python", - "request": "launch", - "program": "${file}", - "console": "integratedTerminal" - }, - { - "name": "Python: Terminal (external)", - "type": "python", - "request": "launch", - "program": "${file}", - "console": "externalTerminal" - }, - { - "name": "Python: Django", - "type": "python", - "request": "launch", - "program": "${workspaceFolder}/manage.py", - "args": [ - "runserver", - "--noreload", - "--nothreading" - ], - "debugOptions": [ - "RedirectOutput", - "Django" - ] - }, - { - "name": "Python: Flask (0.11.x or later)", - "type": "python", + "name": "Python Debugger: Flask", + "type": "debugpy", "request": "launch", "module": "flask", "env": { - "FLASK_APP": "hello_app.webapp" + "FLASK_APP": "hello_app.webapp", + "FLASK_DEBUG": "1" }, "args": [ "run", "--no-debugger", - "--no-reload" // Remove to auto-reload modified pages - ] - }, - { - "name": "Python: Module", - "type": "python", - "request": "launch", - "module": "module.name" - }, - { - "name": "Python: Pyramid", - "type": "python", - "request": "launch", - "args": [ - "${workspaceFolder}/development.ini" - ], - "debugOptions": [ - "RedirectOutput", - "Pyramid" - ] - }, - { - "name": "Python: Watson", - "type": "python", - "request": "launch", - "program": "${workspaceFolder}/console.py", - "args": [ - "dev", - "runserver", - "--noreload=True" - ] - }, - { - "name": "Python: All debug Options", - "type": "python", - "request": "launch", - "pythonPath": "${config:python.pythonPath}", - "program": "${file}", - "module": "module.name", - "env": { - "VAR1": "1", - "VAR2": "2" - }, - "envFile": "${workspaceFolder}/.env", - "args": [ - "arg1", - "arg2" + "--no-reload" ], - "debugOptions": [ - "RedirectOutput" - ] + "jinja": true, + "justMyCode": true } ] }