Skip to content

Instantly share code, notes, and snippets.

@bkawan
Last active February 2, 2018 15:17
Show Gist options
  • Save bkawan/d388dec1a498e3b5e0f69c7267482c43 to your computer and use it in GitHub Desktop.
Save bkawan/d388dec1a498e3b5e0f69c7267482c43 to your computer and use it in GitHub Desktop.
Python Environment Setup and Django for Ubuntu

Python Environment Setup and Django for Ubuntu/Mac OSX/ Windows

You can install and setup environment for Windows/ Mac OSX also. If you find it difficult, leave me a message.

For Windows please follow this link
 https://www.codingforentrepreneurs.com/blog/install-python-django-on-windows/

 https://docs.djangoproject.com/en/2.0/howto/windows/
For Mac OSX please follow the link below
https://www.codingforentrepreneurs.com/blog/install-django-on-mac-or-linux/

P.S The instructions below is for linux(ubuntu) only.

1. Install python 3 ( If your os is not Ubuntu 16.04 )

Ubuntu 16.04 ships with both Python 3 and Python 2 pre-installed
First update and upgrade local APT repository
 $ sudo apt-get update && sudo apt-get -y upgrade
Now Install python3 by following command
  $ sudo apt-get install python3
Verify
  $ python3 -V
  
  Output
  Python 3.6.3

2. Install pip first

$ sudo apt-get install python3-pip
Verify
 $ pip3 -V

3. Install Virtual Environment using pip3

$ sudo pip3 install virtualenv
Verify
$ virtualenv --version
You have successfully installed virtualenv.

4. Install Django

Install Django within a virtualenv.
$ mkdir web-apps
$ cd web-apps
Inside web-apps Let's make virtual environment with python 3. Lets call it venv
  $ virtualenv venv

OR

by giving python version (Alternate of above )
  $ virtualenv -p python3 venv
Activate Virtual Environment
  $ source venv/bin/activate
You will have similar looks on terminal
  (venv) bkawan@ubuntu:$ 
Install Django
  (venv) bkawan@ubuntu:$ pip install django
Verify
  (venv) bkawan@ubuntu:$ python -m django --version

  Output
  2.0.2
To Deactivate Virtual Environment
  $ deactivate
Thats all. You are ready to start django project now;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment