Skip to content

Instantly share code, notes, and snippets.

@mccutchen
Created November 24, 2010 21:11
Show Gist options
  • Save mccutchen/714422 to your computer and use it in GitHub Desktop.
Save mccutchen/714422 to your computer and use it in GitHub Desktop.
@with_appcfg
def prep_local_shell():
"""Prepares a local shell by adjusting the datastore paths according to
the settings and setting up the appropriate stubs."""
import settings
args = dev_appserver_main.DEFAULT_ARGS.copy()
# If a custom datastore directory is requested, modify the args for each
# of the datastore paths
if hasattr(settings, 'DATASTORE_DIR'):
ddir = settings.DATASTORE_DIR
for key in ('datastore_path', 'history_path', 'blobstore_path'):
args[key] = os.path.join(ddir, os.path.basename(args[key]))
# Finally, set up the stubs
dev_appserver.SetupStubs(env.gae.application, **args)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment