
google-app-engine-django - issue #103
Support changing the location of appstore data
I would like to be able to set the location of appstore data much the same way you can using the dev_appserver.py with the manage.py commands. This would enable saving/using appstore data in locations other than /tmp on *nix systems where the data might be deleted at any point.
There are two possible solutions that could be implemented (preferrably both):
- Enabling the --datastore_path and --history_path command line options in manage.py commands (runserver, shell etc.)
- Enabling you to set the datastore path and history path via the settings module. This would require that the --settings command line option be enabled in order for this to be useful (which would require appengine_django to support changing the DJANGO_SETTINGS_MODULE environment variable as overriding the DJANGO_SETTINGS_MODULE is all that the --settings option does).
Comment #1
Posted on Apr 17, 2009 by Grumpy DogThis is a valid feature request, would you be willing to provide a patch?
Comment #2
Posted on Jan 2, 2010 by Happy BearHere's a patch for runserver. Please let me know if this is acceptable.
svn diff appengine_django/management/commands/runserver.py
Index: appengine_django/management/commands/runserver.py
--- appengine_django/management/commands/runserver.py (revision 100) +++ appengine_django/management/commands/runserver.py (working copy) @@ -35,7 +35,7 @@ # hack main so --help in dev_appserver_main works OK. sys.modules['main'] = dev_appserver_main # Set bind ip/port if specified. - if len(sys.argv) > 2: + if len(sys.argv) > 2 and not sys.argv[2].startswith("--"): addrport = sys.argv[2] try: addr, port = addrport.split(":") @@ -62,8 +62,18 @@
# Pass the application specific datastore location to the server. p = get_datastore_paths() - args.extend(["--datastore_path", p[0], "--history_path", p[1]]) + datastore_path = p[0] + history_path = p[1]
- if len(sys.argv) > 2:
- for arg in sys.argv[2:]:
- if arg.startswith("--datastore_path="):
- datastore_path=arg[arg.index("=")+1:]
- elif arg.startswith("--history_path="):
- history_path = arg[arg.index("=")+1:] +
- args.extend(["--datastore_path", datastore_path, "--history_path", history_path])
+
Append the current working directory to the arguments.
dev_appserver_main.main([progname] + args + [os.getcwdu()])
Comment #3
Posted on Apr 16, 2010 by Happy WombatAt first glance, it looks like this patch is only valid for the runserver.py command. But the feature request was for the ability to run this for other manage.py commands. I for one could really use this in 'shell' and 'startapp'.
Comment #4
Posted on Apr 16, 2010 by Happy BearI'll look at shell. Why does startapp need a datastore? I haven't had any issues using startapp without my datastore location. What issues are you running into?
Comment #5
Posted on Apr 16, 2010 by Happy WombatYou're right, apologies, that was a mistake. I can't see a need for startapp.
Comment #6
Posted on Apr 20, 2010 by Happy BearI checked my patch for shell in my fork here: http://code.google.com/p/dherbst-app-engine-django/source/detail?r=3fea1cacf20d15601abda7e0c6deee13497a6370
It may not be the most elegant way to do it, but it works for me.
usage: python manage.py shell --datastore_path=/abs/path/to/file.name
Status: New
Labels:
Type-Enhancement
Priority-Low