-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd7fcae
commit 51d7d2d
Showing
4 changed files
with
76 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
**/__pycache__/ | ||
**/*.pyc | ||
**/*.pyc | ||
**/.venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
Section_3_Your_first_REST_API/Lec_54_Initial_set-up_for_a_Flask_app.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Initial set-up for a Flask app | ||
|
||
python -m venv .venv | ||
|
||
In terminal run <path-to-venv>/Scripts/activate.bat | ||
|
||
Then your terminal will have `(.venv)` in front to signify its working | ||
|
||
``` | ||
(.venv) C:\...\REST_APIs_with_Flask_and_Python_in_2023\Section_3_Your_first_REST_API\.venv\Scripts> | ||
``` | ||
|
||
Then run `pip install flask` in the virtual env. Lib/site-packages should have stuff in it. | ||
|
||
```py | ||
from flask import Flask | ||
|
||
app = Flask(__name__) # Creates flask app that does a lot for us | ||
``` | ||
|
||
Filname and variable must be app. | ||
|
||
Now run with `flask run` | ||
|
||
```sh | ||
>flask run | ||
* Debug mode: off | ||
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. | ||
* Running on http://127.0.0.1:5000 | ||
Press CTRL+C to quit | ||
``` | ||
|
||
Running IP is in the logs above. We will be able to intercept that data and do something with it. | ||
|
||
`Ctrl+c` to stop | ||
|
||
Now we are ready to make an endpoint. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from flask import Flask | ||
|
||
app = Flask(__name__) # Creates flask app that does a lot for us |