Skip to content

25c/data25c

Repository files navigation

Setup
=====

1. Install virtualenv/pip

Sample install on Mac OS X:

$ curl -O https://raw.github.com/pypa/virtualenv/master/virtualenv.py
$ chmod +x virtualenv.py
$ sudo mv virtualenv.py /usr/local/bin

For more about virtualenv and pip (the Python package manager/installer):

http://www.pip-installer.org/en/latest/installing.html

2. Set up the environment

After cloning the repository, use virtualenv to create an isolated Python environment for the project (this is similar in concept to using rvm to create isolated configurations for Rails apps).

Make sure you are INSIDE the project directory when you run this command:

$ virtualenv.py venv --distribute

The .gitignore file is configured to ignore the venv directory in the project, as it is specific to your local environment.

3. Activate the environment

Every time you wish to do development/testing, run this in the Terminal:

$ source venv/bin/activate

This will modify your environment so it will use the project-specific isolated configuration in venv.

4. Install the dependencies

Now install the specified dependencies using pip:

$ pip install -r requirements.txt


Migrations
==========

To apply any database migrations, after activating the environment, run:

$ yoyo-migrate apply ./migrations/ postgres://superuser@localhost/data25c_development

Replace the database url if necessary.  For deployments:

$ heroku run yoyo-migrate --verbosity=3 -b apply ./migrations \$DATABASE_URL --app data25c-stage

Replace app as necessary


Testing
=======

In the root of the project folder, execute the following command (don't forget to activate the environment variables as described above in step 3):

PYTHON_ENV=test python -m unittest discover

This will set the PYTHON_ENV variable for just the execution of the tests.  The "discover" command will crawl through the current folder looking for tests, importing all the packages it finds along the way.

Ubuntu 12.10 setup
==================

#### REQUIREMENTS ####

$ sudo apt-get install build-essential
$ sudo apt-get install libxml2-dev
$ sudo apt-get install libxslt1-dev
$ sudo apt-get install python2.7-dev
$ sudo apt-get install python-setuptools 
$ sudo apt-get install python-pkg-resources

$ sudo apt-get install python-pip		
$ sudo pip install virtualenv			

$ cd data25c/					

$ virtualenv venv --distribute
$ source venv/bin/activate
$ pip install -r requirements.txt


create datatabases!
### DATABASE CONFIGURATION ###
In postgresql.conf:
  listen_addresses = '*'
  max_prepared_transactions = 10

In pg_hba.conf:
  # IPv4 section
  host    all             all             0.0.0.0/0               md5



### RUN MIGRATIONS ###
$ yoyo-migrate apply ./migrations/ postgres://<user>:<password>@localhost:5432/data25c_development

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages