Waldemar Kornewald avatar Waldemar Kornewald committed 551949e

a few preparations for Python 2.7 support

Comments (0)

Files changed (5)

 # Initialize Django
 from djangoappengine.main import main
 
-from google.appengine.ext.appstats.ui import main
+from google.appengine.ext.appstats.ui import app as application, main
 
 if __name__ == '__main__':
     main()
                 [os.path.join(management_dir, 'commands')]) if not ispkg]
 
 def setup_threading():
-    # XXX: GAE's threading.local doesn't work correctly with subclassing
+    if sys.version_info >= (2, 7):
+        return
+    # XXX: On Python 2.5 GAE's threading.local doesn't work correctly with subclassing
     try:
         from django.utils._threading_local import local
         import threading

deferred/handler.py

 from django.conf import settings
 
 # load all models.py to ensure signal handling installation or index loading
-# of some apps 
+# of some apps
 for app in settings.INSTALLED_APPS:
     try:
         import_module('%s.models' % (app))
     except ImportError:
         pass
 
-from google.appengine.ext.deferred.handler import main
+from google.appengine.ext.deferred.handler import application, main
 
 main = make_profileable(main)
 
 from django.core import signals
 signals.got_request_exception.connect(log_traceback)
 
+# Create a Django application for WSGI
+application = WSGIHandler()
+
+# Add the staticfiles handler if necessary
+if settings.DEBUG and 'django.contrib.staticfiles' in settings.INSTALLED_APPS:
+    from django.contrib.staticfiles.handlers import StaticFilesHandler
+    application = StaticFilesHandler(application)
+
 def real_main():
     # Reset path and environment variables
     global path_backup
     os.environ.update(env_ext)
     setup_logging()
 
-    # Create a Django application for WSGI
-    application = WSGIHandler()
-
-    # Add the staticfiles handler if necessary
-    if settings.DEBUG and 'django.contrib.staticfiles' in settings.INSTALLED_APPS:
-        from django.contrib.staticfiles.handlers import StaticFilesHandler
-        application = StaticFilesHandler(application)
-
     # Run the WSGI CGI handler with that application.
     run_wsgi_app(application)
 

management/commands/deploy.py

 from ...boot import PROJECT_DIR
+from ...utils import appconfig
 from django.conf import settings
 from django.core.management import call_command
 from django.core.management.base import BaseCommand
 
     new_args = argv[:]
     new_args[1] = 'update'
+    if appconfig.runtime != 'python':
+        new_args.insert(1, '-R')
     new_args.append(PROJECT_DIR)
     syncdb = True
     if '--nosyncdb' in new_args:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.