Let'sh
Project Init(Backend)

Virtual Environment

The first thing we need to do before initializing project with python is to set up virutal environment. Virtual Environment indicates the independent environment that is isolated from currently installed Python environment. In other words, we are basically setting individual Python development environment per each projects independently.

Why would we need to do this? We need to install many packages while doing projects and if those packages have their own dependencies, an error would occur if package versions are different. Moreover, error can also occur when package versions collide with each other after upgrading or installing packages. In order to effectively control over these cumbersome things, it is recommended to set up virtual environment.

Pipenv

Pipenv is a combination of word of pip which is Python package managing tool and virtualenv which helps to create virtual environment.

Installation

Let's install Pipenv first.


pip install pipenv

Creating Virtual Environment

Next, choose which version of Python you would like to use. All commands of Pipenv are at here (opens in a new tab). For me, I used the most recent version of 3.11 as of July 2023.


pipenv --python 3.11

Installing Necessary Packages

Next, install necessary packages (opens in a new tab) with using pipenv keyword. Before install packages, make sure you install packages under the project root folder.


mkdir letsh
cd letsh
pipenv install django

success

Poetry

Poetry (opens in a new tab) is another Python package manage tool.

🚨

I found out that Poetry takes too much slow speed when downloading certain packages1. Therefore, I ended up choosing to use Pipenv for this project.

Installtion

Install Poetry with curl.


curl -sSL https://install.python-poetry.org | POETRY_HOME=/etc/poetry python3 -

Creating .lock File

Next, navigate to project root folder and create .lock file with the following command.


mkdir letsh
cd letsh
poetry init

Poetry Init

Installing Necessary Packages

And we can install Django now.


poetry add django

Poetry Django


Frontend (React + TS)

I decided to use React with TypeScript, and used Vite (opens in a new tab) for making boilerplate.

Create React App (opens in a new tab), which I used to use quite often, installed too many unnecessary packages that makes my project heavier and it didn't allow me to customize the packages that I want.

Creating Project

We can create project by using the following command (opens in a new tab). As I will be using React with TypeScript, I included react-ts command keyword.


pnpm create vite letsh --template react-ts

What is PNPM?2 PNPM은 NPM

Footnotes

  1. Poetry is extremely slow when resolving the dependencies (opens in a new tab)

  2. Let's settle things out [2]: NPM Vs. YARN VS. PNPM (opens in a new tab)