Setup Django Environments
06 Dec 2014In order to actually build projects, we need to make sure our computer is setup. In this project, we’ll setup your environment. Made for Mac OS X Mavericks which is the latest, free operating system from Apple.
Step:
-
Check Python version:
$ python --version
-
Install PIP (A tool for installing and managing Python packages):
$ sudo easy_install pip
-
Install Setuptools (Easily download, build, install, upgrade, and uninstall Python packages):
$ sudo easy_install setuptools
-
Install Virtualenv (A tool to create isolated Python environments):
$ sudo pip install virtualenv
-
Install MySQL Python:
$ sudo pip install mysql-python
-
Activate virtual environments:
$ virtualenv somename $ cd somename/ $ source bin/activate (somename)$ pip freeze
-
Install Django in virtual machine:
(somename)$ pip install django==1.4.5 (somename)$ pip install django --upgrade Tip: replace first line with `#!/usr/bin/env python` in `bin/easy_install`, etc.
-
Deactivate virtual environments:
(somename)$ deactivate
-
Install Django in your local machine:
$ sudo easy_install django // or $ sudo pip install django
-
Start Django project:
$ django-admin.py startproject my_project $ cd my_project/ $ python manage.py runserver
-
Specify dependencies with Pip:
$ pip freeze > requirements.txt $ pip install -r requirements.txt