Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
vms:python:dev [2017/04/14 01:12]
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 127: Line 142:
 ADD: ADD:
  
-VirtualenvWrapper +USER INSTALLED BINARIES [virtualenv(wrapper)] 
-export WORKON_HOME=$HOME/projects/​.virtualenvs +export PATH=~/​.local/​bin:​$PATH 
-export PROJECT_HOME=$HOME/projects/code + 
-export VIRTUALENVWRAPPER_PYTHON=/​usr/​bin/​python3 +# VIRTUALENVWRAPPER 
-export ​PATH=~/.local/​lib/​python3.4/bin:$PATH +export WORKON_HOME=$HOME/​.virtualenvs 
-source $HOME/​.local/​lib/​python3.4/​bin/​virtualenvwrapper.sh+export PROJECT_HOME=$HOME[/code] 
 +export VIRTUALENVWRAPPER_PYTHON=/​usr/​bin/​python[2|3] 
 +export ​VIRTUALENVWRAPPER_VIRTUALENV=$HOME/.local/bin/​virtualenv 
 + 
 +source $HOME/​.local/​bin/​virtualenvwrapper.sh
  
 > source .bashrc > source .bashrc
Line 153: Line 172:
  
 [[http://​wiki.strategicz.com/​vhyper/​doku.php?​id=vms:​python:​django#​using_a_shared_folder_to_host_your_projects]] [[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]]