Required:
- Python 3.4=<
- Pip
- Virtualenv
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6
apt-get -y install python3-pip
Installing virtualenv and virtualenvwrapper using pip:
sudo pip3 install virtualenv virtualenvwrapper
Add following lines in ~/.bashrc :
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
source /usr/local/bin/virtualenvwrapper.sh
Creating new environment:
virtualenv env-name
or
virtualenv -p python3.6 envname
List of environments:
workon
Change environment:
workon env-name
Deactivate(Exit from) environmet:
deactivate
Delete environment:
rmvirtualenv env-name
In activated environment you can install packages using pip:
pip3 install django
or specified version
pip3 insatall django==1.8
For example:
git clone https://github.com/username/repo.git
Export all required packages to requirements.txt:
pip3 freeze > requirements.txt
This way allow you to avoid "Package not found" and other types of errors in future:
pip3 install -r requirements.txt
If it required make migrations, type following commands:
python manage.py makemigrations
python manage.py migrate
After that, if:
- Dependecies satisfied
- Requirements installed
- Migrations passed
python manage.py runserver localhost:8000
and follow in browser http://localhost:8000