My favorites | Sign in
Project Home Downloads Issues Source
Repository:
Checkout   Browse   Changes   Clones    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# -*- coding: utf-8 -*-
"""WSGI app setup."""
import os
import sys

# Add lib as primary libraries directory, with fallback to lib/dist
# and optionally to lib/dist.zip, loaded using zipimport.
lib_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'lib')
if lib_path not in sys.path:
sys.path[0:0] = [
lib_path,
os.path.join(lib_path, 'dist'),
os.path.join(lib_path, 'dist.zip'),
]


from tipfy.app import App
from config import config
from urls import rules

def enable_appstats(app):
"""Enables appstats middleware."""
from google.appengine.ext.appstats.recording import \
appstats_wsgi_middleware
app.dispatch = appstats_wsgi_middleware(app.dispatch)

def enable_jinja2_debugging():
"""Enables blacklisted modules that help Jinja2 debugging."""
if not debug:
return
from google.appengine.tools.dev_appserver import HardenedModulesHook
HardenedModulesHook._WHITE_LIST_C_MODULES += ['_ctypes', 'gestalt']

# Is this the development server?
debug = os.environ.get('SERVER_SOFTWARE', '').startswith('Dev')

# Instantiate the application.
app = App(rules=rules, config=config, debug=debug)
enable_appstats(app)
enable_jinja2_debugging()

def main():
app.run()

if __name__ == '__main__':
main()

Change log

2f96e1bc9276 by Rodrigo Moraes <rodrigo.moraes> on May 10, 2011   Diff
Dropped set_syst_path, main.py sets the
path and we avoid unexpected results.
Go to: 
Sign in to write a code review

Older revisions

981a05b4fba3 by Rodrigo Moraes <rodrigo.moraes> on Apr 24, 2011   Diff
Call set_path() actually inside
main().
29099f92601e by Rodrigo Moraes <rodrigo.moraes> on Apr 23, 2011   Diff
Fixed weird set_sys_path side effect.
Thanks for the the report and
solution, guys. :) (Fixes  issue 81 )
3583e813832d by Rodrigo Moraes <rodrigo.moraes> on Apr 2, 2011   Diff
Added set_sys_path.py. Helps when you
have multiple bootstraps.
All revisions of this file

File info

Size: 1291 bytes, 46 lines
Powered by Google Project Hosting