Django project environment construction

This is my local environment construction memo.

environment

pyenv, python installation

Python is pre-installed on mac, Since the version is 2 series, install 3 series from pyenv. https://github.com/pyenv/pyenv

##First install pyenv
$ brew install pyenv

Edit .zprofile (.bash_profile for bash)

I will add below

eval "$(pyenv init -)"

Enabling the pvenv command

Load the edited .zprofile and enable the pvenv command.

$ source ~/.zprofile

Install Python 3.7.1 from pvenv

$ pyenv install 3.7.1
$ pyenv global 3.7.1

Virtualize your Django project environment

Don't include extra packages in your local global environment (package management on a project-by-project basis) Install Django-related packages on top of your virtual environment.

Use the venv module to create a virtual environment.

venv virtual environment construction

##Create project directory
$ mkdir hogeproject
$ cd hogeproject

##venv virtual environment creation
$ python -m venv myhogeenv

##When you check the created directory, it looks like this
$ pwd
/xxxx/xxxx/hogeproject

$ tree -L 3
.
└── myhogeenv
    ├── bin
    │   ├── activate
    │   ├── activate.csh
    │   ├── activate.fish
    │   ├── easy_install
    │   ├── easy_install-3.7
    │   ├── pip
    │   ├── pip3
    │   ├── pip3.7
    │   ├── python -> /Users/xxxx/.pyenv/versions/3.7.1/bin/python
    │   └── python3 -> python
    ├── include
    ├── lib
    │   └── python3.7
    └── pyvenv.cfg

Virtual environment startup

##Start-up
$ source myhogeenv/bin/activate

##Prompt when startup is complete(myhogeenv)Is attached.
(myhogeenv) $

Django installation

Install Django with the venv virtual environment running. (Django installed with pip)

##Requirements described in Django version.Place txt
(myhogeenv) $ echo "Django~=2.2.4"  > requirements.txt

##Deployed requirements.txt Directory check
(myhogeenv) $ pwd
/xxxx/xxxx/hogeproject

(myhogeenv) $ tree -L 3
.
├── myhogeenv
│   ├── bin
│   │   ├── activate
│   │   ├── activate.csh
│   │   ├── activate.fish
│   │   ├── easy_install
│   │   ├── easy_install-3.7
│   │   ├── pip
│   │   ├── pip3
│   │   ├── pip3.7
│   │   ├── python -> /Users/xxxx/.pyenv/versions/3.7.1/bin/python
│   │   └── python3 -> python
│   ├── include
│   ├── lib
│   │   └── python3.7
│   └── pyvenv.cfg
└── requirements.txt

##Django installation
(myhogeenv) $ pip install -r requirements.txt

Recommended Posts

Django project environment construction
django project development environment construction
Django environment construction
django environment construction
Django development environment construction memo
Docker + Django + React environment construction
Mac + Eclipse (PyDev) + Django environment construction
[Django] Memorandum of environment construction procedure
[For beginners] Django -Development environment construction-
DeepIE3D environment construction
Emacs-based environment construction
Linux environment construction
Python environment construction
Environment construction (python)
CodeIgniter environment construction
python environment construction
Python --Environment construction
Django Project Baseline
Python environment construction
Golang environment construction
python environment construction
Word2vec environment construction
Python project environment construction procedure (for windows)
Environment construction: GCP + Docker
python windows environment construction
Go language environment construction
ConoHa environment construction memo
homebrew python environment construction
PyData related environment construction
Anaconda-4.2.0-python3 environment construction (Mac)
Python development environment construction
YOLO v4 environment construction ①
pyenv + fish environment construction
Django --start project without start project
python2.7 development environment construction
BigGorilla environment construction memo
[Django] Rename the project
[Django3] Environment construction and various settings summary [Python3]
grip environment construction onCentOS6.5
Anaconda environment construction memo
From 0 to Django development environment construction to basic operation
Start a Django project
Golang environment construction [goenv]
Mac environment construction Python
Pyxel environment construction (Mac)
[Memo] Django development environment
Python environment construction @ Win7
Web application made with Python3.4 + Django (Part.1 Environment construction)
[Python] Django environment construction (pyenv + pyenv-virtualenv + Anaconda) for macOS
[Ubuntu 18.04] Tensorflow 2.0.0-GPU environment construction
Python + Anaconda + Pycharm environment construction
About Linux environment construction (CentOS)
Minimal website environment with django
PyTorch C ++ (LibTorch) environment construction
Django Getting Started: 2_ Project Creation
Anaconda environment construction on CentOS7
Django Getting Started: 1_Environment Building
First LAMP environment construction (Linux)
Python environment construction (Windows10 + Emacs)
CI environment construction ~ Python edition ~
Shell to create django project