Skip to content

Commit

Permalink
Move datastore flush handler so it's not used in production.
Browse files Browse the repository at this point in the history
  • Loading branch information
User committed Apr 9, 2012
1 parent cc9fbda commit a6a493b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ def setup_project():
logging.warn('Could not patch modules whitelist. '
'The compiler and parser modules will not work and '
'SSL support is disabled.')
# In SDK 1.6.4, the datastore doesn't save automatically on exit.
# Register a handler to make sure we save. This is important on
# manage.py commands other than 'runserver'. Note that with runserver,
# the datastore is flushed twice. This should be acceptable.
import atexit
if hasattr(dev_appserver, 'TearDownStubs'):
atexit.register(dev_appserver.TearDownStubs)
elif not on_production_server:
try:
# Restore the real subprocess module
Expand Down Expand Up @@ -189,10 +196,3 @@ def setup_project():
sys.path.remove(path)
sys.path = extra_paths + sys.path

# In SDK 1.6.4, the datastore doesn't save automatically on exit.
# Register a handler to make sure we save. This is important on
# manage.py commands other than 'runserver'. Note that with runserver,
# the datastore is flushed twice. This should be acceptable.
import atexit
if hasattr(dev_appserver, 'TearDownStubs'):
atexit.register(dev_appserver.TearDownStubs)

0 comments on commit a6a493b

Please sign in to comment.