# Package can be under 'lib/<pkg>/<pkg>/' or 'lib/<pkg>/lib/<pkg>/' detect = (os.path.join(path, dir), os.path.join(path, 'lib', dir)) for path in detect: if os.path.isdir(path): EXTRA_PATHS.append(os.path.dirname(path)) break sys.path = EXTRA_PATHS + sys.path from google.appengine.api import apiproxy_stub_map # Add this folder to sys.path sys.path = [os.path.abspath(os.path.dirname(__file__))] + sys.path setup_project() from appenginepatcher.patch import patch_all patch_all() if not manage_py_env: return print 'Running on app-engine-patch 1.0' def setup_project(): # Remove the standard version of Django for k in [k for k in sys.modules if k.startswith('django')]: del sys.modules[k] from appenginepatcher import on_production_server if on_production_server: # This fixes a pwd import bug for os.path.expanduser() global env_ext
# -*- coding: utf-8 -*- import os, sys # Add current folder to sys.path, so we can import aecmd current_dir = os.path.abspath(os.path.dirname(__file__)) sys.path = [current_dir] + sys.path import aecmd aecmd.setup_project() from appenginepatcher.patch import patch_all, setup_logging patch_all() import django.core.handlers.wsgi from google.appengine.ext.webapp import util from django.conf import settings def real_main(): os.environ.update(aecmd.env_ext) setup_logging() # Create a Django application for WSGI. application = django.core.handlers.wsgi.WSGIHandler() # Run the WSGI CGI handler with that application. util.run_wsgi_app(application) def profile_main(): import logging, cProfile, pstats, random, StringIO