Skip to content
This repository has been archived by the owner on May 4, 2019. It is now read-only.

Detailed setup guide (Linux)

MorganCabral edited this page Aug 9, 2012 · 11 revisions

Setting up a development environment (Detailed)

Installing Prerequisites

See here

Install Python 2.7.x, PIP and Virtualenv

You should be doing this through whatever package manager is installed on your system.

# Use this for Ubuntu
$ sudo apt-get update && sudo apt-get install python python-pip

# Use this for Fedora/RHEL/etc.
$ sudo yum update && sudo yum install python python-pip

# Use this for Arch Linux
$ sudo pacman -Syu python2 python2-pip
$ # Symlink from /usr/bin?/pip to /usr/bin/pip2.7

In most cases you should have python already installed, but it never hurts to be overly specific :P. Once you have python and PIP installed, you can use PIP to pull down the latest version of virtualenv.

$ sudo pip install --upgrade pip
$ sudo pip install --upgrade virtualenv

Clone the git repo

$ cd ~/some/directory
$ git clone https://github.com/MorganCabral/sse-library.git

You can clone this directory to wherever you want, so long as the directory is not public. There's nothing technically stopping you from doing that, but that does possibly introduce security issues if people have access to the settings files and such.

Create your virtual environment

$ cd ~/some/directory/sse-library
$ virtualenv env

This command will create a directory called "env" in our project root directory which contains a bare-bones Python 2.7.x environment. This environment will have PIP installed for us already.

Its important to note the name of the virtual environment created. Right now the project's .gitignore file will explicitly ignore the env directory. If you don't mind making changes to the .gitignore file you can name the virtual environment whatever you want. Basically, we don't want the virtual environment directory added to the project because there are system specific things going on under the hood.

Activate the virtual environment

$ cd ~/some/directory/sse-library
$ source env/bin/activate

This command will set up temporary symlinks so that when you make calls to the python interpreter, it will use the virtual environment's interpreter instead of the system's. This is done to avoid any possible conflicts between packages on the system and the project dependencies we will install later.

You will know that this was successful if you see something to the effect of "(env)" in your terminal input line thingy.

(env)mcabral@Titanium:~/Projects/sse-library$

If you need to use the system's python intepreter for some reason, you can break out of the virtual environment by using the deactivate command

$ deactivate

Setup project dependencies

Make sure that your virtual environment is active before running the following.

$ cd ~/some/directory/sse-library
$ pip install -r requirements.txt

This will install Django, South, and any other project dependencies into our virtual environment's python site-packages directory.

Database Setup (Optional)

See Here.

Initial Database Sync

Make sure that your virtual environment is active before running the following.

$ cd ~/some/directory/sse-library/sse_library
$ python2 manage.py syncdb

This will go ahead and set up the database tables we need for our Django instance. You may be asked to create a superuser if you haven't already done so; make sure that there is at least one superuser present. This will make editing stuff easier down the road.