Anonymous committed 3c7039f

store App Engine DB and other data in project root folder. On Linux and OS X the tmp folder is cleared on every reboot and we don't really want to lose our precious dev data

Comments (0)

Files changed (2)

 import sys
 PROJECT_DIR = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
+DATA_ROOT = os.path.join(PROJECT_DIR, '.gaedata')
 # Overrides for os.environ
 env_ext = {'DJANGO_SETTINGS_MODULE': 'settings'}
     if have_appserver:
         # App Engine's threading.local is broken
+    elif not os.path.exists(DATA_ROOT):
+        os.mkdir(DATA_ROOT)
     if not have_appserver:
 from ..utils import appid, have_appserver, on_production_server
+from ..boot import DATA_ROOT
 from .creation import DatabaseCreation
 from django.db.backends.util import format_number
 from djangotoolbox.db.base import NonrelDatabaseFeatures, \
     from import dev_appserver_main
     datastore_path = options.get('datastore_path',
-                                 dev_appserver_main.DEFAULT_ARGS['datastore_path'].replace(
-                                 'dev_appserver', 'django_%s' % appid))
+                                 os.path.join(DATA_ROOT, 'datastore'))
     blobstore_path = options.get('blobstore_path',
-                                 dev_appserver_main.DEFAULT_ARGS['blobstore_path'].replace(
-                                 'dev_appserver', 'django_%s' % appid))
+                                 os.path.join(DATA_ROOT, 'blobstore'))
     history_path = options.get('history_path',
-                               dev_appserver_main.DEFAULT_ARGS['history_path'].replace(
-                               'dev_appserver', 'django_%s' % appid))
+                               os.path.join(DATA_ROOT, 'history'))
     return datastore_path, blobstore_path, history_path
 def get_test_datastore_paths(inmemory=True):