Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 48 lines (34 sloc) 1.334 kb
0a24c7cd » rmanocha
2012-03-29 Adding support for libraries
1 import os
2 import sys
3 import logging
4
5
6 DEBUG = os.environ.get('SERVER_SOFTWARE', '').startswith('Dev')
7
8
9 # Add lib as primary libraries directory, with fallback to lib/dist
10 # and optionally to lib/dist.zip, loaded using zipimport.
11 lib_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'lib')
12 logging.info(lib_path)
13 if lib_path not in sys.path:
14 sys.path[0:0] = [
15 lib_path,
16 ]
17
18 # Append zip archives to path for zipimport
19 for filename in os.listdir(lib_path):
20 if filename.endswith((".zip", ".egg")):
21 sys.path.insert(0, "%s/%s" % (lib_path, filename))
22
23 logging.info(sys.path)
24
25 from google.appengine.ext import admin
26 from werkzeug_debugger_appengine import get_debugged_app
27
28 from simple import app
29
30
31 def enable_appstats(app):
32 """Enables appstats middleware."""
33 from google.appengine.ext.appstats.recording import \
34 appstats_wsgi_middleware
35 app.wsgi_app = appstats_wsgi_middleware(app.wsgi_app)
36
37
38 def enable_jinja2_debugging():
39 """Enables blacklisted modules that help Jinja2 debugging."""
40 from google.appengine.tools.dev_appserver import HardenedModulesHook
41 HardenedModulesHook._WHITE_LIST_C_MODULES += ['_ctypes', 'gestalt']
42
43 admin_app = admin.application
44
45 #enable_appstats(app)
46 if app.config['DEBUG']:
47 app = get_debugged_app(app)
48 enable_jinja2_debugging()
Something went wrong with that request. Please try again.