Skip to content

Latest commit

 

History

History
369 lines (292 loc) · 7.07 KB

useful-commands.md

File metadata and controls

369 lines (292 loc) · 7.07 KB

← Back: Documentation Overview

Useful commands




🐍 Python


🐍 Pyenv: Install python

pyenv must be installed.
Must run inside same directory as .python-version.

pyenv install


🐍 Python: Call submodule of Python

python -m <module>
# Example:
python -m poetry


🐍 Python: Install poetry

python -m pip install poetry


🐍 Poetry: Install virtual environment with dependencies

Must run inside same directory as Pipfile.

POETRY_VIRTUALENVS_IN_PROJECT=1 python -m poetry install


🐍 Poetry: Install package

python -m poetry install <package>


🐍 Poetry: Uninstall package

python -m poetry uninstall <package>


🐍 Poetry: Activate virtual environment

python -m poetry shell


🐍 Poetry: Run command inside virtual environment

python -m poetry run <command>
# Example:
python -m poetry run python -V


🐍 Django: Show all commands

python -m poetry run python manage.py


🐍 Django: Run command

# Locally:
python -m poetry run python manage.py <command>
# Inside container:
docker compose exec backend python -m poetry run python manage.py <command>


🐍 Django: Makemigrations

# Locally: 
python -m poetry run python manage.py makemigrations


🐍 Django: Migrate

# Locally: 
python -m poetry run python manage.py makemigrations


🐍 Django: Start server

python -m poetry run python manage.py runserver


🐍 Django: Show all urls

python -m poetry run python manage.py show_urls -f table


🐍 Django: Collect all staticfiles

python -m poetry run python manage.py collectstatic


🐍 Django: Open shell

python -m poetry run python manage.py shell_plus


🐍 Django: Collect all staticfiles

python -m poetry run python manage.py collectstatic



🐳 Docker


Be sure to check out the documentation for Docker command aliases.

🐳 Docker: Run command inside container

<container-name> is defined under services in docker-compose.yml.

docker compose exec <container-name> <command>
# Example:
docker compose exec backend echo "Hello World!"


🐳 Docker: Remove containers

<container-name> is defined under services in docker-compose.yml.

docker compose down


🐳 Docker: Open shell in container

<container-name> is defined under services in docker-compose.yml.

docker compose exec <container-name> <command>
# Example:
docker compose exec backend bash


🐳 Docker: Run command inside already running container

<container-name> is defined under services in docker-compose.yml.

docker compose exec <container-name> <command>
# Example:
docker compose exec backend echo "Hello World!"


🐳 Docker: Run a one-off container with command

--rm removes container after exiting.
<container-name> is defined under services in docker-compose.yml.

docker compose run --rm <container-name> <command>
# Example:
docker compose run --rm backend echo "Hello World!"


🐳 Docker: Build project

docker compose build


🐳 Docker: Start all containers

docker compose up


🐳 Docker: Start individual container

<container-name> is defined under services in docker-compose.yml.

docker compose up <container-name>
# Example:
docker compose up backend



🧶 Yarn

Must run in same directory as package.json.


🧶 Npm: Install yarn

npm install --global yarn


🧶 Yarn: Install dependencies

yarn install


🧶 Yarn: Install package

yarn add <package>


🧶 Yarn: Uninstall package

yarn remove <package>


🧶 Yarn: Start server

yarn start


🧶 Yarn: Start Storybook

yarn storybook


🧶 Yarn: Open Cypress GUI

yarn cypress open


🧶 Yarn: Run Cypress (no GUI)

yarn cypress run