Установка Django в виртуальное окружение на сервере с CentOS

Подключаем репозиторий EPEL(i686)

wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm

Для архитектуры x86_64

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Устанавливаем python-pip

yum install -y python-pip

Обновляем pip

pip-python install --upgrade pip
Downloading/unpacking pip
  Downloading pip-1.3.1.tar.gz (247Kb): 247Kb downloaded
  Running setup.py egg_info for package pip
    warning: no files found matching '*.html' under directory 'docs'
    warning: no previously-included files matching '*.txt' found under directory 'docs/_build'
    no previously-included directories found matching 'docs/_build/_sources'
Installing collected packages: pip
  Found existing installation: pip 0.8
    Uninstalling pip:
      Successfully uninstalled pip
  Running setup.py install for pip
    warning: no files found matching '*.html' under directory 'docs'
    warning: no previously-included files matching '*.txt' found under directory 'docs/_build'
    no previously-included directories found matching 'docs/_build/_sources'
    Installing pip script to /usr/bin
    Installing pip-2.6 script to /usr/bin
Successfully installed pip
Cleaning up...


Проверяем текушую версию

pip --version
pip 1.3.1 from /usr/lib/python2.6/site-packages (python 2.6)

Устанавливаем virtualenv

pip install virtualenv
Downloading/unpacking virtualenv
  Downloading virtualenv-1.9.1.tar.gz (2.0MB): 2.0MB downloaded
  Running setup.py egg_info for package virtualenv
    warning: no previously-included files matching '*' found under directory 'docs/_templates'
    warning: no previously-included files matching '*' found under directory 'docs/_build'
Installing collected packages: virtualenv
  Running setup.py install for virtualenv
    warning: no previously-included files matching '*' found under directory 'docs/_templates'
    warning: no previously-included files matching '*' found under directory 'docs/_build'
    Installing virtualenv script to /usr/bin
    Installing virtualenv-2.6 script to /usr/bin
Successfully installed virtualenv
Cleaning up...

Для удобства работы с virtualenv устанавливаем virtualenvwrapper

pip install virtualenvwrapper

Создаем пользователя для работы с веб проектом

useradd <username>
passwd <username>
su <username>
cd

Создаем папку для виртуального окружения

mkdir ~/.virtualenvs

Добавляем в ~/.bashrc

export WORKON_HOME=$HOME/.virtualenvs
source /usr/bin/virtualenvwrapper.sh

Перечитываем изменения

source ~/.bashrc

Теперь можем оздавать виртуальные окружения

mkvirtualenv <name>

Активировать виртуальное окружение

workon <name>

Деактивировать виртуальное окружение

deactivate или ctr+d

Удалить виртуальное окружение

rmvirtualenv <name>

Устанавливаем Django

(<name>)[user@server ~]$ pip install django

Добавить комментарий

Ваш адрес email не будет опубликован.