Skip to content

Commit

Permalink
- don't auto deploy from travis for now
Browse files Browse the repository at this point in the history
- added a 404 page
  • Loading branch information
lheagy committed May 15, 2016
1 parent 7311e8e commit 54cc878
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 19 deletions.
11 changes: 5 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,15 @@ install:
- conda install --yes pip python=$TRAVIS_PYTHON_VERSION numpy scipy matplotlib cython
ipython sphinx
- pip install -r requirements.txt
- gcloud -q components update gae-python

script:
- nosetests $TEST_DIR

deploy:
provider: gae
skip_cleanup: false
keyfile: emgeosci-eca6c1b5ec64.json
project: emgeosci
# deploy:
# provider: gae
# skip_cleanup: false
# keyfile: emgeosci-eca6c1b5ec64.json
# project: emgeosci

notifications:
email:
Expand Down
20 changes: 16 additions & 4 deletions app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,36 @@ api_version: 1
threadsafe: yes

handlers:

- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico

- url: /(.*\.css)
mime_type: text/css
static_files: _build/html/\1
upload: _build/html/(.*\.css)

- url: /(.*\.html)
mime_type: text/html
static_files: _build/html/\1
upload: _build/html/(.*\.html)

- url: /
static_files: _build/html/index.html
upload: _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))

- url: .*
- url: /
script: emgeosci.app

- url: /.*
static_files: _build/html/error.html
upload: _build/html/error.html


libraries:
- name: webapp2
Expand Down
2 changes: 1 addition & 1 deletion conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build','AUTHORS.rst','README.md','content/equation_bank/*', 'content/maxwell1_fundamentals/maxwell_variables.rst']
exclude_patterns = ['_build','AUTHORS.rst','README.md','content/equation_bank/*', 'content/maxwell1_fundamentals/maxwell_variables.rst', 'error.rst']

linkcheck_ignore = ['http://mybinder.org/repo/ubcgif/em_examples',
'http://www.austhaigeophysics.com/A%20Comparison%20of%202D%20and%203D%20IP%20from%20Copper%20Hill%20NSW%20-%20Extended%20Abstract.pdf',
Expand Down
12 changes: 5 additions & 7 deletions emgeosci.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import cgi
import datetime
import webapp2
import logging

from google.appengine.ext import ndb
from google.appengine.api import users
Expand All @@ -28,29 +29,26 @@
import urllib, hashlib
import json

TEMPLATEFOLDER = '_build/html/'

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/'
def setTemplate(self, template_values, templateFile, _templateFolder=TEMPLATEFOLDER):
# 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):
setTemplate(self, {"indexPage":True}, 'index.html')

app = webapp2.WSGIApplication([
('/', MainPage)
('/', MainPage),
], debug=True)

13 changes: 13 additions & 0 deletions error.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. _error:

[404 Error]
===========

:( Something has gone wrong

The requested URL was not found on this server.


- `Get me back <http://em.geosci.xyz>`_


1 change: 0 additions & 1 deletion index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ 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 54cc878

Please sign in to comment.