Dev Environment Setup

Abdul Salim edited this page Dec 18, 2013 · 17 revisions

All Platforms

Get a GitHub account at Github.com

Install an IDE (or text editor). We will be using PyCharm for group development during the meetings, but feel free to use anything that you are comfortable with.

Linux (Debian / Ubuntu)

Install Git

You may already have it installed. Run a check in your terminal (version number may be different):

$ git --version
    git version 1.8.3.2

If you don't have it installed run:

$ sudo apt-get install git

Install PIP

$ sudo apt-get install python-pip

Install VirtualEnv

$ sudo pip install virtualenv

Install VirtualEnvWrapper

$ sudo pip install virtualenvwrapper

Configure VirutalEnvWrapper by adding the following to your /home/your_name/.bashrc file

$ source /usr/local/bin/virtualenvwrapper.sh

Update your environment running your .bashrc file

$ source .bashrc

Here are some commands to help you use virtualenvwrapper effectively:

http://virtualenvwrapper.readthedocs.org/en/latest/command_ref.html

Mac OS X - via MacPorts

Install MacPorts

Install Git

If you have Xcode install you already have git. :) To check run the following command.

$ git --version 

If you don't have it installed run:

$ sudo port install git

Install pip

$ sudo port install py27-pip

Install virtualenv

$ sudo port install py27-virtualenv 

Install virtualenv-wrapper

$ sudo port install py27-virtualenvwrapper

Install Postgres Database Server

$ sudo port install postgresql92

Mac OS X - using system Python

Install Git

If you have Xcode install you already have git. :) To check run the following command.

$ git --version 

If you don't have Git installed, go to the Git Downloads Page to get the OSX installer. Run the installer and then test to see if it is working

$ git --version 

Install pip

$ sudo easy_install pip

Install virtualenv

$ sudo pip install virtualenv 

Install virtualenv-wrapper

$ sudo pip install virtualenvwrapper

Install Postgres Database Server There are multiple options for installing Postgres, read more about it at the Postgres OSX Downloads Page

Nitrous

If you want to hack on Stacks but don't want to do it on your own machine then Nitrous.io should help you out. Nitrous will give you a dev environment, web IDE and terminal to get Stacks up and running in a few minutes.

Setup your account

Go to Nitrous.io and sign up and activate your account. When you are all done, you will end up on the page below then click the "Create Box" button.

Pick the 'Golang' box template as it the barest box setup and then pick the memory and storage your want. It would make sense to pick the Django template but since we are working with virtual environments, you would still install Django again.

If for some reason you pick the wrong config template, you can delete and recreate your box easily. To do this just shutdown the box terminate it, then create a new box.

Installation

In the terminal section, take the following steps

$ git clone https://github.com/PyMNtos/stacks.git

You already have pip, python 2.7 and Virtualenvwrapper on the boxes so go ahead and just configure Virtualenvwrapper.

Configure VirtualEnvWrapper

$ echo source /usr/local/bin/virtualenvwrapper.sh >> ./.bashrc 

Update your environment running your .bashrc file

$ source .bashrc

Install Postgres

$ parts install postgresql
$ parts start postgresql

Configuring Postgres

$ psql postgres

CREATE DATABASE stacks;
CREATE USER stacks WITH PASSWORD 'stacks';
GRANT ALL PRIVILEGES ON DATABASE stacks TO stacks;
\q # To quit

At this point you should still be in this path

$ /home/action

You can now continue from the Create Virtual Environment section of the installation steps.

After you finish those steps, type the following to run the app then click the preview button at the top left side of the page

  $ python manage.py runserver '0.0.0.0:4000'