Skip to content

GettingStarted

Hiroshi Ichikawa edited this page Aug 5, 2015 · 31 revisions
« back to DeveloperGuide

You can develop on Linux, or Mac OS, or Windows-with-Cygwin.


Step 1. Get tools

You will probably be happiest if you do these steps in order.

Python 2.7.x (you may already have this; try running "python" or "python2.7" to check)

  • All platforms: Download here and install
  • Mac OS X: the pre-installed Python binaries are at /System/Library/Frameworks/Python.framework/Versions/2.x/bin/python2.x and are symlinked from /usr/bin/python2.x. If you downloaded and installed a new version, it will be in /Library/Frameworks rather than /System/Library/Frameworks, and you'll need to ln -s /Library/Frameworks/Python.framework/Versions/2.7/bin/python /usr/bin/python2.7

Setuptools 0.6c11 and EasyInstall (you may already have this; try running "easy_install" or "easy_install-2.7" to check)

  • All platforms: Download, then tar xvfz and sudo python2.7 setup.py install inside the extracted directory.
  • Ubuntu: sudo apt-get install python-setuptools

Git — for revision control (you may already have this; try running "git" to check)

PIL 1.1.7 — optional, only needed if you want to test photo uploading locally

  • All platforms: Download then tar xvfz and sudo python2.7 setup.py install inside the extracted directory.

Latest App Engine SDK for Python

  • All platforms: Download the Linux zip file (regardless of your platform) of Google App Engine SDK for Python from here and unzip in your home directory.

py.test — for running unit tests

  • All platforms: sudo easy_install-2.7 pytest

Gettext — for internationalization

  • Linux: sudo apt-get install gettext
  • Mac OS 10.7: Download, double-click, and install.
  • Mac OS 10.8: Download, double-click, and install.

Step 2. Get the code

  • Make a local clone of the code repository with this command. (This assumes you want to put the code in a directory called pf:
    git clone https://github.com/google/personfinder.git pf

Step 3. Run the app locally

All the following commands should be done from the application directory (the pf directory we created in the previous step).

cd pf

In one terminal, start a local server with this command:

tools/gae run app --port=8000 # Brings up a local dev_appserver on port 8000

If this is the first time to run Person Finder on your machine, open a separate terminal and enter this command to initialize the datastore:

tools/console :8000 -c 'setup_datastore()' # Connects to localhost:8000 and executes setup_datastore()

This will connect to your app and create a few example repositories such as "haiti" and "japan".

Step 4. Try the app!

Now you should be able to use the app by going to http://localhost:8000/ in a browser, where you'll see the repositories listed on the left.

You can also run tests like this:

tools/all_tests

You may see some warning about the version of Python but it is okay to ignore it now.

If you would like to contribute code, please see HowToDevelop.

Step 5. (optional) Set up additional repositories

Person Finder usually has one repository per crisis incident. Each repository can be customized with a title, set of languages, announcements, and other settings.

To create a new repository, go to the administration page at http://localhost:8000/haiti/admin and next to "Select a repository" choose "Create new...", then fill in the box with a new repository identifier and click Create. You can then edit the settings page for your newly created repository and click "Save these settings" to save your edits.

If you would like to be able to read and write data in your new repository through the Person Finder API, you will need to create an API key, which you can do at http://localhost:8000/repo/admin/api_keys (replace repo with your repository identifier).

« back to DeveloperGuide
Clone this wiki locally