python - django dumpdata empty array -


i new django , using make website online game. game has it's own auth stuff using custom auth model django.

i created new app called 'account' put stuff in , added models. added router , enabled in settings , works good, can log in admin site , stuff.

now trying learn tdd, need dump auth database fixture. when run ./manage.py dumpdata account empty array back. there aren't errors or trace ever, empty array. i've fiddled best can can't seem find issue is.

here relevant settings.

database

databases = {       'default': {           'engine': 'django.db.backends.postgresql_psycopg2',           'name': 'censored',           'user': 'censored',           'password': 'censored',           'host': 'localhost',           'port': '',       },         'auth_db': {           'engine': 'mysql_pymysql',           'name': 'censored',           'user': 'censored',           'password': 'censored',           'host': '127.0.0.1',           'port': '3306'       }   } 

router

class accountrouter(object):     """     router control database operations on models in     account application.     """     def db_for_read(self, model, **hints):         """         attempts read account models go auth_db.         """         if model._meta.app_label == 'account':             return 'auth_db'         return none      def db_for_write(self, model, **hints):         """         attempts write account models go auth_db.         """         if model._meta.app_label == 'account':             return 'auth_db'         return none      def allow_relation(self, obj1, obj2, **hints):         """         allow relations if model in account app involved.         """         if obj1._meta.app_label == 'account' or \            obj2._meta.app_label == 'account':                 return true         return none      def allow_syncdb(self, db, model):         """         make sure account app appears in 'auth_db'         database.         """         if model._meta.app_label == 'account':             return false         return none 

django settings

database_routers = ['account.router.accountrouter'] 

i @ loss try, or ideas appreciated.

i had same issue, need specify correct database. example, given code:

$ ./manage.py dumpdata --database=auth_db account 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -