Commits

Rod Morison committed db509ac

First pass, sandbox site

Comments (0)

Files changed (7)

+application: t5sandbox
+version: 1
+runtime: python
+api_version: 1
+
+handlers:
+- url: /fb/t5sandbox/auth/.*
+  script: coneslib/cones/fbcontroller.py
+  
+- url: .*
+  script: main.py

sandbox/appengine_config.py

+from google.appengine.ext.appstats import recording
+from coneslib.gaesessions import SessionMiddleware
+import config
+
+def webapp_add_wsgi_middleware(app):
+    app = SessionMiddleware(app, cookie_key=config.SESSION_COOKIE_KEY)
+    #if config.CONFIG == 'stage':
+        #app = recording.appstats_wsgi_middleware(app)
+    return app

sandbox/config.py

+import os
+import logging
+
+#
+# Platform configs should all be changed in the config_* files
+#
+
+if os.environ['SERVER_SOFTWARE'].find('Development') >= 0:
+    logging.info('Config from config_dev')
+    from config_dev import *
+    CONFIG = 'dev'
+elif os.environ['APPLICATION_ID'].find('t5sandbox') >= 0:
+    logging.info('Config from config_stage')
+    from config_stage import *
+    CONFIG = 'stage'
+elif os.environ['APPLICATION_ID'].find('changme-to-app-name') >= 0:
+    logging.info('Config from config_prod')
+    from config_prod import *
+    CONFIG = 'prod'
+else:
+    logging.fatal('No config found!')
+    raise Exception('No config found!')
+
+#
+# Following configs should not require change unless you're
+# rejiggering the app itself.
+#
+APP_ROOT = os.path.dirname(__file__)
+APP_URI = "http://" + APP_HOST + APP_PATH
+
+# Initialize fbuser model with the app instance
+from coneslib.cones.fbuser import FbUserBase
+FbUser = FbUserBase

sandbox/config_dev.py

+
+# Change if the Facebook app changes
+FB_APP_ID = "130597283654834"
+FB_APP_SECRET = "565b92a74ab494d0bdce9daea6ed1826"
+FB_URI = "http://apps.facebook.com/tfivesandbox"
+
+# Change if the app server (or dns) changes
+APP_HOST = "bolet.morison.org"
+
+# Change if the app root file path changes
+APP_PATH = "/fb/t5sandbox"
+
+# Sesssion cookie key. Keys should be at least 32 bytes (RFC2104).  Tip: generate your
+# key using ``os.urandom(64)`` but do this OFFLINE and copy/paste here
+SESSION_COOKIE_KEY = FB_APP_SECRET
+
+DEBUG = True

sandbox/config_stage.py

+
+# Change if the Facebook app changes
+FB_APP_ID = "130597283654834"
+FB_APP_SECRET = "565b92a74ab494d0bdce9daea6ed1826"
+FB_URI = "http://apps.facebook.com/tfive-hearts"
+
+# Change if the app server (or dns) changes
+APP_HOST = "t5-hearts.appspot.com"
+
+# Change if the app root file path changes
+APP_PATH = "/fb/t5sandbox"
+
+# Sesssion cookie key. Keys should be at least 32 bytes (RFC2104).  Tip: generate your
+# key using ``os.urandom(64)`` but do this OFFLINE and copy/paste here
+SESSION_COOKIE_KEY = FB_APP_SECRET
+
+DEBUG = False

sandbox/index.yaml

+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.
+#!/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.
+#
+from google.appengine.ext import webapp
+from google.appengine.ext.webapp import util
+
+
+class MainHandler(webapp.RequestHandler):
+    def get(self):
+        self.response.out.write('Hello world!')
+
+
+def main():
+    application = webapp.WSGIApplication([('/', MainHandler)],
+                                         debug=True)
+    util.run_wsgi_app(application)
+
+
+if __name__ == '__main__':
+    main()