Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jasonmelgoza/26fc0f20d9584d8652bb4e1847cd7a72 to your computer and use it in GitHub Desktop.
Save jasonmelgoza/26fc0f20d9584d8652bb4e1847cd7a72 to your computer and use it in GitHub Desktop.
Setting up and using Python3 Virtualenv and Django on Mac

Python3 Virtualenv Setup

Requirements
  • Python 3
  • Pip 3
$ brew install python3

Pip3 is installed with Python3

Installation

To install virtualenv via pip run:

$ pip3 install virtualenv
Usage

Creation of virtualenv:

$ virtualenv -p python3 <desired-path>

Activate the virtualenv:

$ source <desired-path>/bin/activate

Deactivate the virtualenv:

$ deactivate

About Virtualenv

Setup Django

Install Django:

$ pip install django

Start new django project

$ django-admin startproject mysite

or tell Django to install the files in a selected directory

$ django-admin.py startproject mysite ~/mysite

Migrate database:

$ ./manage.py migrate

Run dev server:

$ ./manage.py runserver 0.0.0.0:8000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment