|
|
# Get started using Python and FastAPI on IBM i.
|
|
|
|
|
|
First step is to switch branch to "Step-1"
|
|
|
After cloning the repository to your machine, type the following commands, pressing `Enter` after each line...
|
|
|
|
|
|
On the command line, type `git checkout -f Step-1`
|
|
|
Enter cloned folder
|
|
|
|
|
|
You should get a confirmation, similar to this
|
|
|
`cd fastapi`
|
|
|
|
|
|
```
|
|
|
Branch 'Step-1' set up to track remote branch 'Step-1' from 'origin'.
|
|
|
Switched to a new branch 'Step-1'
|
|
|
```
|
|
|
Make sure we are on the right branch ( -f to force )
|
|
|
|
|
|
Confirm folder has changed, by typing `ls -la`
|
|
|
`git checkout -f main`
|
|
|
|
|
|
Now to view the code, type `vim main.py` |
|
|
\ No newline at end of file |
|
|
Create a virtual environment for our project dependencies
|
|
|
|
|
|
`python -m venv .venv`
|
|
|
|
|
|
Enter the virtual environment
|
|
|
|
|
|
`source .venv/bin/activate`
|
|
|
|
|
|
Install the packages `wheel`, `fastapi` and `hypercorn`
|
|
|
|
|
|
`pip install wheel fastapi hypercorn`
|
|
|
|
|
|
Create our main python file
|
|
|
|
|
|
`touch main.py`
|
|
|
|
|
|
Anden open it in a editor
|
|
|
|
|
|
`vim main.py`
|
|
|
|
|
|
Proceed to next page |
|
|
\ No newline at end of file |