본문 바로가기

macOS에서 django 개발환경 셋팅하는 순서

오토씨 2022. 2. 12.

01. pyenv (Simple Python Version Management)
$ brew install pyenv
$ vi ~/.zshrc
    export PYENV_ROOT="$HOME/.pyenv"
    export PATH="$PYENV_ROOT/bin:$PATH"
    eval "$(pyenv init --path)"
    eval "$(pyenv init -)"
$ pyenv install 3.x.x
$ pyenv global 3.x.x

02. pipenv (Python Dev Workflow for Humans)
$ brew install pipenv
$ mkdir {project/dir}
$ cd {project/dir}
$ pipenv --three
$ code .
vscode-terminal> pipenv shell
vscode-terminal> pipenv install django==4.x.x

03. github
- Create a new repository
- Skip this step if you're importing an existing repository
- copy HTTP URL
vscode-terminal> git init
vscode-terminal> git remote add origin https://github.com/asdf/asdf.git
vscode-terminal> vi README.md
vscode-terminal> vi .gitignore
    python gitignore 추가
    .DS_Store 추가
vscode-terminal> git add .
vscode-terminal> git commit -m "asdf"
vscode-terminal> git push -u origin main

04. vscode Extensions
vscode-terminal> django-admin startproject config .
- manage.py open
- select python interpreter
- vscode Extensions install (flake8, black)
- Project Home Dir > .vscode > settings.json
{
  "python.pythonPath": "/Users/dk/.local/share/virtualenvs/project_dir-kYONRkCI/bin/python",
  "python.linting.flake8Enabled": true,
  "python.linting.pylintEnabled": false,
  "python.linting.enabled": true,
  "python.formatting.provider": "black",
  "python.linting.flake8Args": ["--max-line-length=88"]
}
- Manage > Settings > format on save search > Editor: Format On Save check

'dev > Python' 카테고리의 다른 글
defaultdict  (0) 2022.03.04
django 모듈을 파이썬 소스에서 실행할때..  (0) 2022.02.15
Windows에서 pip.ini 설정하기(proxy)  (0) 2022.02.08
Unicode HOWTO  (0) 2016.05.10
Popular Python recipes  (0) 2016.05.10

댓글