djangogoogle-app-engineapp-engine-patch

Problem with local dumpdata (on django app-engine-patch)


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?


Solution

  • 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:

    The manage.py uses:

    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