Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Latest commit

 

History

History
112 lines (70 loc) · 3.56 KB

02-local-env.en.md

File metadata and controls

112 lines (70 loc) · 3.56 KB

STEP2: Building local environment

Choose either Python or Go and build your local environment.


Building Python environment

1. Install Python

  • If your local version is below Python3.7, install Python3.10.
  • If you have Python3.7 or above, you can skip the installation step.

2. Check your Python version

  • Check if the Python is added to your PATH (usable as commands on your terminal) with the following command.
$ python -V

If the version does not correspond to the Python version you installed, double check your installation as it is not added to your PATH.

📖 Reference

3. Install dependencies

The list of dependent libraries is written in a file called requirements.txt in a typical Python project. You can install the dependencies by running the following command.

$ cd python
$ pip install -r requirements.txt

If you added a library, make sure you add it to requirements.txt.

4. Run the Python app

$ uvicorn main:app --reload --port 9000

If successful, you can access the local host http://127.0.0.1:9000 on our browser and you will see{"message": "Hello, world!"}.


Building Go environment

1. Install Go

  • If your local version is below Go1.14, install Go1.18.
  • If you have Go1.14 or above, you can skip the installation step.

2. Check your Go version

  • Check if Go is added to your PATH (usable as commands on your terminal) with the following command.
$ go version

If the version does not correspond to the Python version you installed, double check your installation as it is not added to your PATH.

📖 Reference

3. Install dependencies

In Go, dependent libraries are managed in a file called go.mod. You can install the dependencies by running the following command.

$ cd go
$ go mod tidy

🔰 Point

Understand the role of go.mod and the commands around it referring to this document.

4. Run the Go app

$ go run app/main.go

If successful, you can access the local host http://127.0.0.1:9000 on our browser and you will see{"message": "Hello, world!"}.


🔰 Points

  • If you're using Linux or Mac, understand when and how .bash_profile and .bashrc are activated and used (or .zshrc if you're using zsh).
  • Understand what it means to add to PATH.

📖 Reference

The following resources are useful to dive deeper into building environments and Linux.


Next

STEP3: Make a listing API