diff --git a/language/python/build-images.md b/language/python/build-images.md index 5d4c138d8d..ec9f38a393 100644 --- a/language/python/build-images.md +++ b/language/python/build-images.md @@ -28,9 +28,11 @@ Let’s create a simple Python application using the Flask framework that we’l ```console $ cd /path/to/python-docker -$ pip3 install Flask -$ pip3 freeze | grep Flask >> requirements.txt -$ touch app.py +$ python3 -m venv .venv +$ source .venv/bin/activate +(.venv) $ python3 -m pip install Flask +(.venv) $ python3 -m pip freeze > requirements.txt +(.venv) $ touch app.py ``` Now, let’s add some code to handle simple web requests. Open this working directory in your favorite IDE and enter the following code into the `app.py` file. @@ -49,7 +51,9 @@ def hello_world(): Let’s start our application and make sure it’s running properly. Open your terminal and navigate to the working directory you created. ```console -$ python3 -m flask run +$ cd /path/to/python-docker +$ source .venv/bin/activate +(.venv) $ python3 -m flask run ``` To test that the application is working properly, open a new browser and navigate to `http://localhost:5000`.