Skip to content
chosak edited this page Feb 3, 2012 · 6 revisions

Clone repository

To clone a read-only version of the Transit Near Me repository, use the following command:

git clone git://github.com/MobilityLab/TransitNearMe.git

This will create a TransitNearMe subdirectory in your local path and check out the source code there.

Install dependencies

Transit Near Me provides a list of requirements as a pip requirements file. Follow the directions here to install pip on your machine.

While not required, it is recommended that you use virtualenv to create a virtual environment within which to install TNM. Doing this greatly simplifies the installation process.

Note that TNM has been developed and tested mainly with Python 2.7. To create a virtual environment, run the following command from the same directory as above:

virtualenv --no-site-packages --distribute --python=python2.7 TransitNearMe

Virtualenv will install its subdirectories into the TransitNearMe subdirectory the code was previously pulled into. To enable the virtualenv, change into the subdirectory and use the command:

source bin/activate

You'll notice that your command prompt has been changed to indicate that the virtual environment is now active.

Next, use the provided requirements file to install TNM's dependencies:

pip install -E . -r deploy/requirements.txt

This installs Django as well as a variety of third-party libraries used by TNM.

Important! If using PostgreSQL, you will need to manually apply the Django patch at https://code.djangoproject.com/ticket/16778 in order for Transit Near Me to work properly.

Configure settings file

Transit Near Me includes a Django settings file template in tnm/local_settings.py.tmpl that must be customized with local machine settings, as documented here. Edit this file and save as tnm/local_settings.py. This file is loaded by the main Django settings.py at runtime.

Create log directory

By default, Transit Near Me writes its log files to a subdirectory of the main TransitNearMe directory. You'll need to either create a TransitNearMe/log/ subdirectory or modify the settings.py file to specify an alternative logging path.

Create database tables

Run syncdb to generate the database tables:

./manage.py syncdb

Django should create all of the database tables required for Transit Near Me. If you encounter errors, you may not have configured your spatial database properly.

Verify installation

Run the Django development server:

./manage.py runserver

You should be able to navigate to http://localhost:8000 and see an empty version of Transit Near Me running! Consult the wiki page on data for information on how to get some data into your application.