Skip to content

Commit 25910cb

Browse files
committed
Merge branch 'master' into SurveysGPR
2 parents 645ef35 + 33bd625 commit 25910cb

File tree

2 files changed

+36
-18
lines changed

2 files changed

+36
-18
lines changed

app.yaml

+17-10
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,29 @@ handlers:
6060
static_files: _build/html/\1
6161
upload: _build/html/(.*\.html)
6262

63+
- url: /error.html
64+
static_files: _templates/error.html
65+
upload: _templates/error.html
66+
67+
6368
# serve index files
6469
- url: /(.+)/
65-
static_files: _build/html/\1/index.html
66-
upload: _build/html/(.+)/index.html
70+
script: emgeosci.app
71+
# static_files: _build/html/\1/index.html
72+
# upload: _build/html/(.+)/index.html
6773

6874
- url: /(.+)
69-
static_files: _build/html/\1/index.html
70-
upload: _build/html/(.+)/index.html
75+
script: emgeosci.app
76+
# static_files: _build/html/\1/index.html
77+
# upload: _build/html/(.+)/index.html
7178

72-
- url: /
73-
static_files: _build/html/index.html
74-
upload: _build/html/index.html
79+
# - url: /
80+
# static_files: _build/html/index.html
81+
# upload: _build/html/index.html
7582

76-
- url: /.*
77-
static_files: _templates/error.html
78-
upload: _templates/error.html
83+
# - url: /.*
84+
# static_files: _templates/error.html
85+
# upload: _templates/error.html
7986

8087
- url: .*
8188
script: emgeosci.app

emgeosci.py

+19-8
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
import json
3131

3232
from webapp2 import Route, RedirectHandler
33+
import webapp2_extras
34+
3335

3436
TEMPLATEFOLDER = '_build/html/'
3537

@@ -62,14 +64,22 @@ def get(self):
6264
self.redirect(('/%s' % os.path.sep.join(path)), permanent=True)
6365

6466

67+
class RedirectIndex(webapp2.RequestHandler):
68+
def get(self, *args, **kwargs):
69+
path = str(self.request.path).split(os.path.sep) + ['index.html']
70+
path = filter(None, path)
71+
self.redirect(('/%s' % os.path.sep.join(path)), permanent=True)
72+
73+
6574
class MainPage(webapp2.RequestHandler):
6675
def get(self):
67-
setTemplate(self, {"indexPage": True}, 'index.html')
76+
setTemplate(self, {"indexPage": True}, '/index.html')
77+
6878

69-
# class Error(webapp2.RequestHandler):
70-
# def get(self):
71-
# setTemplate(self, {}, 'error.html', _templateFolder='_templates/')
72-
# # self.redirect('/error.html', permanent=True)
79+
class Error(webapp2.RequestHandler):
80+
def get(self):
81+
setTemplate(self, {}, '/error.html', _templateFolder='_templates/')
82+
# self.redirect('/error.html', permanent=True)
7383

7484
# pointers = [
7585
# Route('/en/latest/.*', RedirectHandler, defaults={'_uri': '/.*'}),
@@ -84,9 +94,10 @@ def get(self):
8494

8595
app = webapp2.WSGIApplication([
8696
('/_images/.*', Images),
87-
('/en/latest/.*',Redirect),
88-
# Route('/en/latest/', RedirectHandler, defaults={'_uri': '/'}),
89-
('/', MainPage),
97+
('/en/latest/.*', Redirect),
98+
Route(r'/', RedirectHandler, defaults={'_uri': 'index.html'}),
99+
Route(r'<:(.+)>', RedirectIndex),
100+
# ('/', MainPage),
90101
# ('/.*', Error),
91102
], debug=True)
92103

0 commit comments

Comments
 (0)