Skip to content

Commit a6a493b

Browse files
author
User
committed
Move datastore flush handler so it's not used in production.
1 parent cc9fbda commit a6a493b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

boot.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,13 @@ def setup_project():
157157
logging.warn('Could not patch modules whitelist. '
158158
'The compiler and parser modules will not work and '
159159
'SSL support is disabled.')
160+
# In SDK 1.6.4, the datastore doesn't save automatically on exit.
161+
# Register a handler to make sure we save. This is important on
162+
# manage.py commands other than 'runserver'. Note that with runserver,
163+
# the datastore is flushed twice. This should be acceptable.
164+
import atexit
165+
if hasattr(dev_appserver, 'TearDownStubs'):
166+
atexit.register(dev_appserver.TearDownStubs)
160167
elif not on_production_server:
161168
try:
162169
# Restore the real subprocess module
@@ -189,10 +196,3 @@ def setup_project():
189196
sys.path.remove(path)
190197
sys.path = extra_paths + sys.path
191198

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

0 commit comments

Comments
 (0)