From 76a9407baf2293006855aec147d5886551b577cc Mon Sep 17 00:00:00 2001 From: Lindsey Heagy Date: Wed, 11 May 2016 13:25:31 -0700 Subject: [PATCH] first pass at gae site --- app.yaml | 33 +++++++++++++++++++++++++++ emgeosci.py | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++ index.yaml | 12 ++++++++++ 3 files changed, 111 insertions(+) create mode 100644 app.yaml create mode 100644 emgeosci.py create mode 100644 index.yaml diff --git a/app.yaml b/app.yaml new file mode 100644 index 00000000..82de2bfe --- /dev/null +++ b/app.yaml @@ -0,0 +1,33 @@ +application: emgeosci +version: 1 +runtime: python27 +api_version: 1 +threadsafe: yes + +handlers: +- url: /favicon\.ico + static_files: favicon.ico + upload: favicon\.ico + +- url: .* + script: emgeosci.app + +- url: / + static_files: _build/html/index.html + +- url: / + static_dir: _build/html + +- url: /(.*\.(gif|png|jpg|ico|js|css|html)) + static_files: / + upload: _build/html/(.*\.(gif|png|jpg|ico|js|css|html)) + +libraries: +- name: webapp2 + version: "2.5.2" +- name: PIL + version: "1.1.7" +- name: numpy + version: "latest" +- name: jinja2 + version: "latest" diff --git a/emgeosci.py b/emgeosci.py new file mode 100644 index 00000000..441c752e --- /dev/null +++ b/emgeosci.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python +# +# Copyright 2007 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import cgi +import datetime +import webapp2 + +from google.appengine.ext import ndb +from google.appengine.api import users +from google.appengine.api import mail +from google.appengine.api import urlfetch + +import os +import jinja2 +import urllib, hashlib +import json + + +JINJA_ENVIRONMENT = jinja2.Environment( + loader=jinja2.FileSystemLoader(os.path.join(os.path.dirname(__file__).split('/')[:-1])), + extensions=['jinja2.ext.autoescape'], + autoescape=False) + +def setTemplate(self, template_values, templateFile): + _templateFolder = '_build/html/' + # add Defaults + template_values['_templateFolder'] = _templateFolder + template_values['_year'] = str(datetime.datetime.now().year) + + + path = os.path.normpath(_templateFolder+templateFile) + template = JINJA_ENVIRONMENT.get_template(path) + self.response.write(template.render(template_values)) + + + +class MainPage(webapp2.RequestHandler): + def get(self): + # packages = [ + # dict(name="SimPEG", link="simpeg", status="check", color="green", description="A framework for simulation and gradient based parameter estimation in geophysics."), + # dict(name="simpegEM", link="simpegem", status="refresh", color="green", description="A electromagnetic forward modeling and inversion package for SimPEG."), + # dict(name="simpegMT", link="simpegmt", status="refresh", color="orange", description="Magnetotellurics forward and inverse codes for SimPEG"), + # dict(name="simpegFLOW", link="simpegflow", status="flask", color="green", description="Groundwater (vadose zone) flow equations written in the SimPEG framework."), + # dict(name="simpegDC", link="simpegdc", status="flask", color="orange", description="A DC resistivity forward modelling and inversion package for SimPEG."), + # dict(name="simpegPF", link="simpegpf", status="flask", color="orange", description="Potential fields codes for SimPEG. Gravity and Magnetics."), + # dict(name="simpegSEIS", link="simpegseis", status="wrench", color="grey", description="Time and frequency domain forward modeling and inversion of seismic wave."), + # dict(name="simpegGPR", link="simpeggpr", status="wrench", color="grey", description="Forward modelling and inversion of Ground-Penetrating Radar (GPR)."), + # ] + setTemplate(self, {"indexPage":True}, 'index.html') + +app = webapp2.WSGIApplication([ + ('/', MainPage) +], debug=True) diff --git a/index.yaml b/index.yaml new file mode 100644 index 00000000..8e6046de --- /dev/null +++ b/index.yaml @@ -0,0 +1,12 @@ +indexes: + +# AUTOGENERATED + +# This index.yaml is automatically updated whenever the dev_appserver +# detects that a new type of query is run. If you want to manage the +# index.yaml file manually, remove the above marker line (the line +# saying "# AUTOGENERATED"). If you want to manage some indexes +# manually, move them above the marker line. The index.yaml file is +# automatically uploaded to the admin console when you next deploy +# your application using appcfg.py. +