django-synchro icon indicating copy to clipboard operation
django-synchro copied to clipboard

Router settings

Open ppeczek opened this issue 7 years ago • 1 comments

I wanted just to test the library to use my app as a database repository so I set it up very basically:

  1. installed library via github
  2. configured DATABASES
  3. added synchro to INSTALLED_APPS
  4. added SYNCHRO_REMOTE and SYNCHRO_MODELS to app settings

Then I deployed an app on heroku cloud and copied my database from app. Then I changed few things locally. After that I tried to synchronize it via localhost:8000/synchro and via python manage.py synchronize The outcome is quite strange: for the browser synchro I always get the following error:

An error occured: Cannot assign "<Object name>": the current database router prevents this relation. (ValueError)

for shell command I always get the No changes since last synchronization. communicate :cry:

ppeczek avatar Nov 27 '17 20:11 ppeczek

I hope that you also installed and added dbsettings to INSTALLED_APPS. Leaving this aside, it seems your configuration is correct. So debugging arise:

  1. Can you post your settings somewhere?
  2. Did you run synchronize command locally?
  3. When you modify local objects, does something change in synchro_changelog table at all?
  4. Is your local database named 'default'?

It's very strange that the same error does not show in both places. The error generally means that some object has foreign relation and its relation is not being saved to the same database. Can you add __unicode__ methods to your models to show something more beside "<Object name>" (in order to track which model is causing troubles) and ensure that all related models are also listed in SYNCHRO_MODELS?

zlorf avatar Nov 27 '17 21:11 zlorf