Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d8fc246

Browse files
Update README.md
1 parent 71ce90c commit d8fc246

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

‎samples/app/flask/README.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,35 @@ config = {
3232

3333
Then save api.py.
3434

35-
### 3. Install Python modules
35+
### 3. Set up and activate a virtual environment <a name="activate"></a>
36+
37+
A virtual environment is a directory tree which contains Python executable files and other files which indicate that it is a virtual environment. Basically, it's the backbone for running your Python Flask app.
38+
39+
Creation of [virtual environments](https://docs.python.org/3/library/venv.html?ref=hackernoon.com#venv-def) is done by executing the following command:
40+
41+
```
42+
$ python3 -m venv venv
43+
```
44+
45+
**Tip**: Tip: pyvenv is only available in Python 3.4 or later. For older versions please use the [virtualenv](https://virtualenv.pypa.io/en/latest/) tool.
46+
47+
Before you can start installing or using packages in your virtual environment, you’ll need to activate it. Activating a virtual environment will put the virtual environment-specific python and pip executables into your shell’s PATH.
48+
49+
Activate the virtual environment using the following command:
50+
51+
```bash
52+
$ . venv/bin/activate activate
53+
```
54+
55+
### 4. Install Python modules
3656

3757
Open a terminal window and install the MariaDB and Flask modules.
3858

3959
```bash
4060
$ pip install mariadb flask
4161
```
4262

43-
### 4. Start the API project
63+
### 5. Start the API project
4464

4565
```bash
4666
$ python api.py
@@ -50,4 +70,4 @@ That's it! You should now having a running Python/Flask API project. You can tes
5070

5171
## More Resources
5272

53-
* [Getting Started with MariaDB using Docker, Python and MariaDB](https://dev.to/probablyrealrob/getting-started-with-mariadb-using-docker-python-and-flask-38a7) (blog)
73+
* [Getting Started with MariaDB using Docker, Python and MariaDB](https://dev.to/probablyrealrob/getting-started-with-mariadb-using-docker-python-and-flask-38a7) (blog)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /