Permalink
Browse files

updated geocamTiePoint

  • Loading branch information...
2 parents b291f6e + 9b45251 commit d079d560442ca318c61dadb2f9fe900b95e9c08f @jrasky jrasky committed Nov 2, 2012
View
@@ -1,7 +1,160 @@
-Fill me in
+Installation
+============
+
+Requirements
+~~~~~~~~~~~~
+
+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::
+
+ cd $GEOCAM_DIR
+ git clone git://github.com/geocam/geocamMapFasten.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: http://git-scm.com/
+
+Optionally Install virtualenv (Recommended)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Especially for a quick test install, we recommend using the
+`virtualenv <http://pypi.python.org/pypi/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
+ cd $GEOCAM_DIR
+ 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
+ ./manage.py bootstrap --yes
+ source $GEOCAM_DIR/geocamMapFasten/sourceme.sh
+ ./manage.py prep
+
+You'll need to source the ``sourceme.sh`` 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 ``sourceme.sh`` file will also
+take care of activating your virtualenv environment in new shells (if
+you were in a virtualenv when you ran ``setup.py``).
+
+To initialize the database::
+
+ $GEOCAM_DIR/geocamMapFasten/manage.py syncdb
+
+Try It Out
+~~~~~~~~~~
+
+To run the Django development web server::
+
+ $GEOCAM_DIR/geocamMapFasten/manage.py runserver 0.0.0.0:8000
+
+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 ``settings.py`` file, modify the ``DATABASES`` field to point to
+your Cloud SQL database::
+
+ DATABASES = {
+ 'default': {
+ 'ENGINE': 'google.appengine.ext.django.backends.rdbms',
+ 'INSTANCE': 'your cloud sql instance name',
+ 'NAME': 'your database name',
+ }
+ }
+
+App Engine Python uses the ``appcfg.py`` 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 ``appcfg.py`` 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
+ appcfg.py --oauth2 --version=$MYVERSION update .
+ appcfg.py --oauth2 backends . update processing
+
+You should now be able to try out your app at http://yourapp.appspot.com/ .
.. o __BEGIN_LICENSE__
.. 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__
View
@@ -34,6 +34,10 @@ handlers:
- url: /static
static_dir: build/static
+# no auth required on front page
+- url: /
+ script: submodules/geocamAppEngineLibs/main.py
+
- url: /admin/.*
script: submodules/geocamAppEngineLibs/main.py
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 %}
</head>
<body>
@@ -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>
</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="mailto:mapfasten-signup@googlegroups.com">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="http://www.youtube.com/embed/88gt1gj2dbs" frameborder="0" allowfullscreen></iframe>
</div>
{% endblock contents %}
@@ -9,6 +9,6 @@
urlpatterns = patterns(
'mapFastenApp.views',
- 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)
else:
- logging.error('ERROR: Command returned non-zero return value %d' % ret)
+ logging.error('ERROR: Command returned non-zero return value %d', ret)
sys.exit(1)
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')
f.close()
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)
return
- logging.info('generating %s' % outputFile)
+ logging.info('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)
else:
- 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))
else:
- logging.info('requirements file %s is empty' % reqsFile)
+ logging.info('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,
SETTINGS_NAME,
@@ -229,9 +229,9 @@ def doAction(opts, action):
if status != 'NEEDED':
if opts.retry:
- logging.info('Would skip %s, status is %s, but running in retry mode' % (action['name'], status))
+ logging.info('Would skip %s, status is %s, but running in retry mode', action['name'], status)
else:
- logging.info('Skipping step %s, status is %s' % (action['name'], status))
+ logging.info('Skipping step %s, status is %s', action['name'], status)
return
# 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]))
sys.exit(1)
actions = [ACTION_DICT[arg] for arg in args]
else:
actions = ACTIONS
- logging.info('Working in %s' % os.getcwd())
+ logging.info('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).
-disable=W0142,W0403,R0201,W0212,W0613,W0232,R0903,R0904,W0614,C0111,C0301,R0913,C0103,R0914,W0603,R0912,R0915,R0902,F0401,W0402,W0614,C0111,I0011,E1103,R0801,W0201,R0922,W0231
+disable=W0142,W0403,R0201,W0212,W0613,W0232,R0903,R0904,W0614,C0111,C0301,R0913,C0103,R0914,W0603,R0912,R0915,R0902,F0401,W0402,W0614,C0111,I0011,E1103,R0801,W0201,R0922,W0231,R0911
[REPORTS]

0 comments on commit d079d56

Please sign in to comment.