Install the Dsearch

[Table of contents]

Install the Python
Install the virtual environment of the Python
Install the Django
Install the Django Rest Framework
Install others' apps of the Django
Install pyhwp
Install the elasticsearch

Install uwsgi
Install nginx


[Install the Python]

python 3.7 higher (from package or source)


[Install the virtual environment of the Python]

$ pip install virtualenv
$ pip install virtualenvwrapper
$ cd $HOME
$ mkdir .virtualenvs
$ vi .bashrc

아래 내용을 파일의 마지막 라인에 추가

# Virtualenvwrapper settings:
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_VIRTUALENV=$HOME/.local/bin/virtualenv
source ~/.local/bin/virtualenvwrapper.sh
export PATH=.:$PATH

다시로그인

$ mkvirtualenv ds (ds라는 이름으로 가상환경 생성)
$ workon (현재 생성된 가상환경 리스트 보기)
ds
$ workon ds (가상환경에 들어가기)
(ds) $ deactivate (가상환경에 나오기)
$ rmvirtualenv ds (가상환경 삭제하기)


[Install the Django]

(ds) $ cd $HOME
(ds) $ pip install django==3.2.13
(ds) $ django-admin startproject ds
(ds) $ cd ds
(ds) $ python manage.py migrate

<sqlite3 에러가 나오면 조치>
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.5/sqlite3/__init__.py", line 24, in <module>
from dbapi2 import *
File "/usr/local/lib/python2.5/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: No module named _sqlite3

$ sudo yum install sqlite-devel
$ cd /opt/python
$ ./configure --enable-optimizations --enable-loadable-sqlite-extensions
$ make install
<sqlite3 에러가 나오면 조치>

(ds) $ python manage.py createsuperuser
(ds) $ python manage.py startapp ds_admin
(ds) $ python manage.py startapp ds_service


[Install the Django Restframework]

(ds) $ pip install djangorestframework==3.13.1
'rest_framework' (Add in the settings.py)
(ds) $ pip install django-filter==21.1
'django_filters' (Add in the settings.py)
(ds) $ pip install django-cors-headers==3.11.0
'corsheaders' (Add in the settings.py)
(ds) $ pip install -U drf-yasg==1.20.0
'drf_yasg' (Add in the settings.py)
(ds) $ pip install django-rest-auth==0.9.5


[Install others' apps of the Django]

(ds) $ pip install Django-import-export==2.8.0
'import_export' (Add in the settings.py)


[Install the Pyhwp]

(ds) $ pip install lxml==4.8.0
(ds) $ pip install pyhwp==0.1b15


[Install the elasticsearch]

(ds) $ pip install elasticsearch==7.17.3
(ds) $ pip install elasticsearch-dsl==7.4.0


[Install the uwsgi]

(ds) $ pip install uwsgi==2.0.20


댓글