Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
vms:python:dev [2017/04/14 00:02] admin [Virtualenvwrapper] |
vms:python:dev [2017/05/31 02:55] (current) admin [Virtualenvwrapper] |
||
|---|---|---|---|
| Line 62: | Line 62: | ||
| Virtual Environments are used to isolate python versions and package dependencies for each specific project. | Virtual Environments are used to isolate python versions and package dependencies for each specific project. | ||
| + | |||
| + | We'll begin by creating specific users for python: | ||
| + | <Code:bash> | ||
| + | > adduser py2 | ||
| + | ... | ||
| + | <password> | ||
| + | ... | ||
| + | > adduser py3 | ||
| + | ... | ||
| + | <password> | ||
| + | ... | ||
| + | |||
| + | # To act as py2: | ||
| + | > su py2 | ||
| + | </Code> | ||
| We'll install ''virtualenv'' for User only in order to allow coexistence of Python2 and Python3. As the virtualenv binary will bear the same name for 2 & 3, we'll move them on the go: | We'll install ''virtualenv'' for User only in order to allow coexistence of Python2 and Python3. As the virtualenv binary will bear the same name for 2 & 3, we'll move them on the go: | ||
| Line 72: | Line 87: | ||
| > nano ~/.bashrc | > nano ~/.bashrc | ||
| ADD: | ADD: | ||
| - | # Python virtualenv | + | # USER INSTALLED BINARIES [virtualenv(wrapper)] |
| - | alias virtualenv2="~/.local/lib/python2.7/bin/virtualenv" | + | export PATH=$PATH:~/.local/bin/ |
| > source ~/.bashrc | > source ~/.bashrc | ||
| - | > virtualenv2 --version | + | > virtualenv --version |
| 15.1.0 | 15.1.0 | ||
| </Code> | </Code> | ||
| Line 123: | Line 138: | ||
| > mv ~/.local/bin/* ~/.local/lib/python3.4/bin/ | > mv ~/.local/bin/* ~/.local/lib/python3.4/bin/ | ||
| > rm ~/.local/bin | > rm ~/.local/bin | ||
| - | > mkdir projects | + | > mkdir -p projects/code |
| > nano .bashrc | > nano .bashrc | ||
| ADD: | ADD: | ||
| - | # VirtualenvWrapper | + | # USER INSTALLED BINARIES [virtualenv(wrapper)] |
| + | export PATH=~/.local/bin:$PATH | ||
| + | |||
| + | # VIRTUALENVWRAPPER | ||
| export WORKON_HOME=$HOME/.virtualenvs | export WORKON_HOME=$HOME/.virtualenvs | ||
| - | export PROJECT_HOME=$HOME/projects | + | export PROJECT_HOME=$HOME[/code] |
| - | export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 | + | export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python[2|3] |
| - | export PATH=~/.local/lib/python3.4/bin:$PATH | + | export VIRTUALENVWRAPPER_VIRTUALENV=$HOME/.local/bin/virtualenv |
| - | source $HOME/.local/lib/python3.4/bin/virtualenvwrapper.sh | + | |
| + | source $HOME/.local/bin/virtualenvwrapper.sh | ||
| > source .bashrc | > source .bashrc | ||
| Line 151: | Line 170: | ||
| === Projects management === | === Projects management === | ||
| + | |||
| + | [[http://wiki.strategicz.com/vhyper/doku.php?id=vms:python:django#using_a_shared_folder_to_host_your_projects]] | ||
| + | <Code> | ||
| + | > VBoxManage setextradata <VM_NAME> VBoxInternal2/SharedFoldersEnableSymlinksCreate/<SHARE_NAME> 1 | ||
| + | </Code> | ||
| + | |||
| + | <Code> | ||
| + | > nano /etc/fstab | ||
| + | |||
| + | # automount shuup project space | ||
| + | <SHARE_NAME> /home/dev3/projects vboxsf defaults,uid=1001,gid=1001,dmode=775,fmode=774,umask=002 0 0 | ||
| + | |||
| + | </Code> | ||
| [[https://virtualenvwrapper.readthedocs.io/en/latest/projects.html#project-management]] | [[https://virtualenvwrapper.readthedocs.io/en/latest/projects.html#project-management]] | ||
| + | |||
| + | ===== Django ===== | ||
| + | |||
| + | [[http://wiki.strategicz.com/vhyper/doku.php?id=vms:python:django]] | ||