Browse files

updated geocamTiePoint

  • Loading branch information...
2 parents b291f6e + 9b45251 commit d079d560442ca318c61dadb2f9fe900b95e9c08f @jrasky jrasky committed Nov 2, 2012
@@ -1,7 +1,160 @@
-Fill me in
+Our reference platform for GeoCam MapFasten is Ubuntu Linux 12.04 LTS,
+running Python 2.7.3 and Django 1.3. For development we use Django's
+built-in development web server with a SQLite 3.6 database. We also
+develop using Mac OS X 10.6+ but we won't talk about how to install
+dependencies on the Mac since it's more complicated.
+For deployment we deploy to Google App Engine, using Google Cloud SQL
+for the database and App Engine blob storage to hold image data.
+Set Up an Install Location
+Let's create a directory to hold the whole MapFasten installation
+and capture the path in an environment variable we can use
+in the instructions below::
+ export GEOCAM_DIR=$HOME/projects/geocam # or choose your own
+ mkdir -p $GEOCAM_DIR
+Get the Source
+Check out our latest source revision with::
+ git clone git:// geocamMapFasten
+For more information on the Git version control system, visit `the Git home page`_.
+You can install Git on Ubuntu with::
+ sudo apt-get install git-core
+.. _the Git home page:
+Optionally Install virtualenv (Recommended)
+Especially for a quick test install, we recommend using the
+`virtualenv <>`_
+tool to put GeoCam-related Python packages in an isolated sandbox where
+they won't conflict with other Python tools on your system.
+To install virtualenv, create a sandbox named ``packages``, and
+"activate" the sandbox::
+ sudo apt-get install python-virtualenv
+ mkdir virtualenv
+ cd virtualenv
+ virtualenv --system-site-packages geocamMapFasten
+ source geocamMapFasten/bin/activate
+After your sandbox is activated, package management tools such as
+``easy_install`` and ``pip`` will install packages into your sandbox
+rather than the standard system-wide Python directory, and the Python
+interpreter will know how to import packages installed in your sandbox.
+You'll need to source the ``activate`` script every time you log in
+to reactivate the sandbox.
+Install Non-Python Packages
+First install Ubuntu packages::
+ # tools for Python package compilation and management
+ sudo apt-get install python2.7-dev python-pip
+ # database support for development in native django environment
+ sudo apt-get install sqlite3 libsqlite3-dev
+ # handling images
+ sudo apt-get install libpng-dev libjpeg-dev libfreetype6-dev libtiff-dev imagemagick
+ # must install PIL through Ubuntu package system, PyPI version fails on Ubuntu
+ sudo apt-get python-imaging
+Set Up MapFasten
+To install Python dependencies, render icons and collect media for the
+server, run::
+ cd $GEOCAM_DIR/geocamMapFasten
+ ./ bootstrap --yes
+ source $GEOCAM_DIR/geocamMapFasten/
+ ./ prep
+You'll need to source the ```` file every time you open a new
+shell if you want to run GeoCam-related Python scripts such as starting
+the Django development web server. The ```` file will also
+take care of activating your virtualenv environment in new shells (if
+you were in a virtualenv when you ran ````).
+To initialize the database::
+ $GEOCAM_DIR/geocamMapFasten/ syncdb
+Try It Out
+To run the Django development web server::
+ $GEOCAM_DIR/geocamMapFasten/ runserver
+Now you're ready to try it out! Point your browser to http://localhost:8000/ .
+Deploying to App Engine
+These instructions are a work in progress. Your feedback is appreciated!
+Create an App Engine project, give it access to a Google Cloud SQL
+instance, and enable backend support.
+Change the ``application`` field in ``app.yaml`` to the name of your App
+Engine project.
+In the ```` file, modify the ``DATABASES`` field to point to
+your Cloud SQL database::
+ 'default': {
+ 'ENGINE': 'google.appengine.ext.django.backends.rdbms',
+ 'INSTANCE': 'your cloud sql instance name',
+ 'NAME': 'your database name',
+ }
+ }
+App Engine Python uses the ```` script to upload your
+application to the App Engine servers. For testing purposes, you'll
+probably want to have development, staging, and deployment versions of
+your app. We handle this by always giving ```` an explicit
+``--version`` argument at the command line which overrides the
+``version`` setting in ``app.yaml``.
+Note that by default all versions of your app will share the same
+backend called ``processing`` which is used to produce export archives.
+They will also share the same Cloud SQL database and blob storage
+instance as the live deployed version. Use caution!
+To deploy, run::
+ cd $GEOCAM_DIR/geocamMapFasten
+ --oauth2 --version=$MYVERSION update .
+ --oauth2 backends . update processing
+You should now be able to try out your app at .
.. o Copyright (C) 2008-2010 United States Government as represented by
.. o the Administrator of the National Aeronautics and Space Administration.
.. o All Rights Reserved.
-.. o __END_LICENSE__
+.. o __END_LICENSE__
@@ -34,6 +34,10 @@ handlers:
- url: /static
static_dir: build/static
+# no auth required on front page
+- url: /
+ script: submodules/geocamAppEngineLibs/
- url: /admin/.*
script: submodules/geocamAppEngineLibs/
login: admin
@@ -9,7 +9,7 @@
class ClosedBetaMiddleware(object):
def process_request(self, request):
- if request.path.startswith('/public'):
+ if request.path.startswith('/public') or request.path == '/':
return None
if getattr(request, 'user', None) is None or request.user.is_anonymous():
return HttpResponseForbidden('401 Sorry, MapFasten is in closed beta and you do not appear to be on the list of authorized testers.')
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -7,6 +7,9 @@
{% block style %}
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}mapFasten/css/base.css"></link>
+ <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}external/css/bootstrap.min.css"></link>
+ <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}mapFasten/css/base.css"></link>
+ <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}geocamTiePoint/css/backbone.css"></link>
{% endblock style %}
@@ -1,17 +1,17 @@
-<a href="{% url mapFasten_home %}"><img src="{{ STATIC_URL }}mapFasten/icons/mapFastenLogo.png" width="220" height="50" style="margin-left: 5px; margin-top: 5px;"/></a>
-<div id="navBar">
- <span class="navLink"><a href="{% url mapFasten_home %}">Home</a></span>
- <span class="navLink"><a href="{% url geocamTiePoint_overlayIndex %}">Map Overlays</a></span>
+<div id="navbar" class="navbar">
+ <div class="navbar-inner">
+ <ul id="navlist" class="nav">
+ <li><a href="/"><img src="{{ STATIC_URL }}mapFasten/icons/mapFastenLogo.png"/></a></li>
+ <li class="nav_pad_vertical navbar-text"><a href="{% url geocamTiePoint_backbone %}#overlays/">List Overlays</a></li>
+ </ul>
+ <p class="pull-right navbar-text" style="float:right">
{% if user.is_authenticated %}
<a href="{{ logout_url }}"
- title="Logout">
- <span class="in" style="color: #008; font-weight: bold;">Logout</span>
- </a>
- <span style="font-weight: bold;">{{ user.username }}</span>
+ title="Logout">Logout</a>
{% else %} <!-- user.is_authenticated -->
<a href="{{ login_url_with_next }}"
- title="Login">
- <span class="in" style="color: #008; font-weight: bold;">Login</span>
- </a>
+ title="Login">Login</a>
{% endif %} <!-- user.is_authenticated (else) -->
+ </p>
+ </div>
@@ -6,14 +6,22 @@
{% block contents %}
-<div style="max-width: 800px">
-<p>MapFasten helps you quickly align an image or PDF with a map,
-creating a shareable map overlay that you can display in the Google Maps
-API or in KML and combine with other layers.</p>
+<div style="margin-left: 30px; max-width: 800px; text-align: center;">
-<p><a class="welcomeEntry" href="{% url geocamTiePoint_overlayIndex %}">Let's get started &gt;&gt;</a></p>
+<p style="text-align: left;">MapFasten helps you quickly align an image or PDF with a map,
+creating a shareable map layer that you can display in maps
+based on the Google Maps API and combine with other layers.</p>
+<p style="text-align: left;"><i>MapFasten is currently in closed beta. You
+must be on the trusted testers list to get access. If you want to use
+MapFasten for activities related to crisis response, please send email
+explaining what you plan to do to <a
+href="">the mapfasten-signup
+mailing list</a></i>.</p>
+<p><a class="btn btn-primary get-started" href="{% url geocamTiePoint_backbone %}#overlays/">Let's get started &gt;&gt;</a></p>
+<iframe width="560" height="315" src="" frameborder="0" allowfullscreen></iframe>
{% endblock contents %}
@@ -9,6 +9,6 @@
urlpatterns = patterns(
- url(r'^$', lambda request: redirect(reverse('geocamTiePoint_backbone')),
+ url(r'^$', 'home',
{}, 'mapFasten_home'),
@@ -86,27 +86,27 @@ def dosys(cmd, continueOnError=False):
ret = os.system(cmd)
if ret != 0:
if continueOnError:
- logging.warning('WARNING: Command returned non-zero return value %d' % ret)
+ logging.warning('WARNING: Command returned non-zero return value %d', ret)
- logging.error('ERROR: Command returned non-zero return value %d' % ret)
+ logging.error('ERROR: Command returned non-zero return value %d', ret)
def writeFileMakeDir(path, text):
- dir = os.path.dirname(path)
- if not os.path.exists(dir):
- os.makedirs(dir)
+ d = os.path.dirname(path)
+ if not os.path.exists(d):
+ os.makedirs(d)
f = file(path, 'w')
f.write(text + '\n')
def fillTemplate(inputFile, outputFile, context):
if os.path.exists(outputFile):
- logging.warning('WARNING: File %s exists, not overwriting. Move current version out of the way to regenerate' % outputFile)
+ logging.warning('WARNING: File %s exists, not overwriting. Move current version out of the way to regenerate', outputFile)
-'generating %s' % outputFile)
+'generating %s', outputFile)
from django.template import Template, Context
from django.conf import settings
@@ -140,9 +140,9 @@ def linkSubmodules(opts):
relativeSrc = '../%s' % src
dst = 'apps/%s' % appName
if os.path.lexists(dst):
- logging.debug(' %s -> %s skipped (already exists)' % (dst, relativeSrc))
+ logging.debug(' %s -> %s skipped (already exists)', dst, relativeSrc)
- logging.debug(' %s -> %s' % (dst, relativeSrc))
+ logging.debug(' %s -> %s', dst, relativeSrc)
os.symlink(relativeSrc, dst)
@@ -162,7 +162,7 @@ def installRequirements(reqsFile):
if hasRequirements(reqsFile):
dosys('%spip install -r %s' % (sudoStr, reqsFile))
-'requirements file %s is empty' % reqsFile)
+'requirements file %s is empty', reqsFile)
def installSubModuleRequirements(opts):
@@ -192,7 +192,7 @@ def needSettings(opts):
def genSettings(opts):
- secretKey = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)])
+ secretKey = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for _i in range(50)])
fillTemplate('management/templates/%s' % SETTINGS_NAME,
@@ -229,9 +229,9 @@ def doAction(opts, action):
if status != 'NEEDED':
if opts.retry:
-'Would skip %s, status is %s, but running in retry mode' % (action['name'], status))
+'Would skip %s, status is %s, but running in retry mode', action['name'], status)
-'Skipping step %s, status is %s' % (action['name'], status))
+'Skipping step %s, status is %s', action['name'], status)
# confirm with user
@@ -260,14 +260,14 @@ def doit(opts, args):
if args:
for arg in args:
if arg not in ACTION_DICT:
- print >>sys.stderr, 'ERROR: there is no action %s' % arg
- print >>sys.stderr, 'Available actions are: %s' % (' '.join([a['name'] for a in ACTIONS]))
+ print >> sys.stderr, 'ERROR: there is no action %s' % arg
+ print >> sys.stderr, 'Available actions are: %s' % (' '.join([a['name'] for a in ACTIONS]))
actions = [ACTION_DICT[arg] for arg in args]
actions = ACTIONS
-'Working in %s' % os.getcwd())
+'Working in %s', os.getcwd())
for action in actions:
doAction(opts, action)
@@ -68,11 +68,13 @@ load-plugins=
# R0922 = Abstract class is only referenced 1 times
# W0231 = __init__ method from base class 'x' is not called
+# R0911 = Too many return statements
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once).

0 comments on commit d079d56

Please sign in to comment.