Skip to content

Commit 709cdb9

Browse files
committed
Update readme
1 parent 2ae3a94 commit 709cdb9

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

README.md

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
# Python/Flask Tutorial for Visual Studio Code
22

33
* 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.
4-
* To run the app, first run use `set FLASK_APP=hello_app:app` (Windows cmd) or `FLASK_APP=hello_app:app` (macOS/Linux).
54
* 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).
5+
* To run the app:
6+
1. Run the command `cd hello_app`, which is the folder that contains the Flask app.
7+
1. Run the command `set FLASK_APP=webapp` (Windows cmd) or `FLASK_APP=webapp` (macOS/Linux) to point to the app module.
8+
1. Start the Flask server with `flask run`.
69

7-
## Navigation
10+
## The startup.py file
811

9-
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`).
12+
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).
13+
14+
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.
15+
16+
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`).
1017

1118
## Contributing
1219

0 commit comments

Comments
 (0)