views:

180

answers:

1

I'm using django with app-engine-patch and I'm having this wierd problem running manage.py dumpdata from local store (works fine when I use the --remote option)

I'm running a local development server that has some test data on it. I can see that data on the admin site. However running manage.py dumpdata all I get is this:

[{"pk": "agZmaWRkbWVyEQsSC2RqYW5nb19zaXRlGAEM", "model": "sites.site", "fields": {"domain": "example.com", "name": "example.com"}}]

Its not even related to what I'm working on. As if when running manage.py dumpdata, it loads a new dev_appserver that reads data from some unknown location that's not the default store.

Any idea where this dumpdata comes from?

+1  A: 

The problem it app-engine-patch manage.py uses a different datastore path than the defualt path used when running dev_appserver.py

The default is:

  • %TEMP%\dev_appserver.datastore
  • %TEMP%\dev_appserver.datastore.history

The manage.py uses:

  • %TEMP%\django_**.datastore
  • %TEMP%\django_**.datastore.history

This can be customized via the project settings. The function that is incharge of this difference is in\django\db\backends\appengine\base.py:

def get_datastore_paths(settings_dict):
  """Returns a tuple with the path to the datastore and history file.

  The datastore is stored in the same location as dev_appserver uses by
  default, but the name is altered to be unique to this project so multiple
  Django projects can be developed on the same machine in parallel.

  Returns:
    (datastore_path, history_path)
  """
  from google.appengine.tools import dev_appserver_main
  options = settings_dict['DATABASE_OPTIONS']
  datastore_path = options.get('datastore_path',
      dev_appserver_main.DEFAULT_ARGS['datastore_path'].replace(
          "dev_appserver", "django_%s" % appid))
  history_path = options.get('history_path',
      dev_appserver_main.DEFAULT_ARGS['history_path'].replace(
          "dev_appserver", "django_%s" % appid))
  return datastore_path, history_path
Eran Kampf