Skip to content

Commit

Permalink
first pass at gae site
Browse files Browse the repository at this point in the history
  • Loading branch information
lheagy committed May 11, 2016
1 parent bd561d0 commit 76a9407
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 0 deletions.
33 changes: 33 additions & 0 deletions app.yaml
Original file line number Diff line number Diff line change
@@ -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"
66 changes: 66 additions & 0 deletions emgeosci.py
Original file line number Diff line number Diff line change
@@ -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)
12 changes: 12 additions & 0 deletions index.yaml
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 76a9407

Please sign in to comment.