Virtualenv for different version of django
I want to use different django version. how can开发者_如何转开发 i create django virtualenv. Please help.
Create your virtualenv:
virtualenv myenv
Activate that virtualenv:
source myenv/bin/activate
Install Django:
pip install Django
Run your project:
python manage.py runserver
you need virtualenv and pip. write in shell:
for debian:
apt-get install python-pip
for fedoras(python 2.4, change if you have another version):
yum install python-setuptools
cd /tmpwget http://pypi.python.org/packages/source/p/pip/pip-0.6.3.tar.gz#md5=0602fa9179cfaa98e41565d4a581d98c
tar -xzf pip-0.6.3.tar.gz
cd pip-0.6.3
/usr/bin/python2.4 setup.py install
next:
pip install virtualenv
next:
mkdir enviroments # folder for your different virtual environments
cd enviroments # go to new folder
virtualenv --no-site-packages django1.3 # create folder with new django
cd django1.3 # go to this folder
source bin/activate # activate environment
pip install Django==1.3 # install django 1.3
check Django version (in shell too):
python
import django
django.get_version() # you should get '1.3.0 final'
quit()
now you can run your server.
quit from virtual environment:
deactivate
delete environment:
rm -r ./bin && virtualenv --clear
for example, you want to install MySQLdb module for your environment:
cd enviroments # go to your environments folder
source django1.3/bin/activate # activate it
pip install django1.3/ MySQL-python # install module
精彩评论