syncdb problem with mongodb engine

78 views
Skip to first unread message

Lianghong Xu

unread,
Oct 19, 2015, 12:15:39 PM10/19/15
to Django users
Hi,

I'm new to django. I'd like to use MongoDB as my backend engine and have installed all the required packages for a MongoDB django setup. However, when I run "python manage.py syncdb", I get this error:

Traceback (most recent call last):

  File "./manage.py", line 10, in <module>

    execute_from_command_line(sys.argv)

  File "/h/lianghon/repo/mywiki/mywiki/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 453, in execute_from_command_line

    utility.execute()

  File "/h/lianghon/repo/mywiki/mywiki/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute

    self.fetch_command(subcommand).run_from_argv(self.argv)

  File "/h/lianghon/repo/mywiki/mywiki/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 272, in fetch_command

    klass = load_command_class(app_name, subcommand)

  File "/h/lianghon/repo/mywiki/mywiki/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 77, in load_command_class

    module = import_module('%s.management.commands.%s' % (app_name, name))

  File "/h/lianghon/repo/mywiki/mywiki/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module

    __import__(name)

  File "/h/lianghon/repo/mywiki/mywiki/local/lib/python2.7/site-packages/south/management/commands/__init__.py", line 13, in <module>

    from south.management.commands.syncdb import Command as SyncCommand

  File "/h/lianghon/repo/mywiki/mywiki/local/lib/python2.7/site-packages/south/management/commands/syncdb.py", line 19, in <module>

    from south.db import dbs

  File "/h/lianghon/repo/mywiki/mywiki/local/lib/python2.7/site-packages/south/db/__init__.py", line 84, in <module>

    db = dbs[DEFAULT_DB_ALIAS]

KeyError: 'default'


I searched a lot on the Internet on this problem and most answers are like this one: 

"You don't have correct DATABASES in your settings. There should be a database named 'default'".


However, I don't think there is a problem with my settings file which already sets the default database:


DATABASES = {

    'default': {

        'ENGINE': 'django_mongodb_engine',

        'NAME': 'wikipedia',

    }

}


The Django version I'm using is 1.5.11. Any help would be very much appreciated! 


Thanks!

Lianghong

Lianghong Xu

unread,
Oct 19, 2015, 12:15:39 PM10/19/15
to Django users
Hi,

I'm new to django. I would like to use MongoDB as my backend engine and installed all required packages for a MongoDB setup. However, when I run "python manage.py syncdb", I get the following error message:

(mywiki)lianghon@172-19-151-114:~/repo/mywiki/testwiki$ python manage.py syncdb

Traceback (most recent call last):

  File "manage.py", line 10, in <module>

    execute_from_command_line(sys.argv)

  File "/h/lianghon/repo/mywiki/mywiki/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line

    utility.execute()

  File "/h/lianghon/repo/mywiki/mywiki/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute

    self.fetch_command(subcommand).run_from_argv(self.argv)

  File "/h/lianghon/repo/mywiki/mywiki/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 272, in fetch_command

    klass = load_command_class(app_name, subcommand)

  File "/h/lianghon/repo/mywiki/mywiki/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 75, in load_command_class

    module = import_module('%s.management.commands.%s' % (app_name, name))

  File "/h/lianghon/repo/mywiki/mywiki/local/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module

    __import__(name)

  File "/h/lianghon/repo/mywiki/mywiki/local/lib/python2.7/site-packages/south/management/commands/__init__.py", line 13, in <module>

    from south.management.commands.syncdb import Command as SyncCommand

  File "/h/lianghon/repo/mywiki/mywiki/local/lib/python2.7/site-packages/south/management/commands/syncdb.py", line 19, in <module>

    from south.db import dbs

  File "/h/lianghon/repo/mywiki/mywiki/local/lib/python2.7/site-packages/south/db/__init__.py", line 84, in <module>

    db = dbs[DEFAULT_DB_ALIAS]

KeyError: 'default'



I've searched a lot on the Internet on this problem and most answers are like this: 

"You don't have correct DATABASES in your settings. There should be a database named 'default'"


My DATABASES settings is as follows: 


DATABASES = {

    'default': {

        'ENGINE': 'django_mongodb_engine',

        'NAME': 'wikipedia',

    }

}


I don't think there is a problem with my settings. The mongodb server on my localhost is working fine. The django version I'm using is 1.5.11. 

James Schneider

unread,
Oct 19, 2015, 12:44:33 PM10/19/15
to django...@googlegroups.com

The version of Django you are running has not been supported for quite a while, you should update your Django installation to 1.7 or 1.8. There may be a compatibility issue if you have a new version of the plugin but an old Django installation.

You should also look to see if there is a support ticket queue for the MongoDB app you are using since Django doesn't support it out of the box. I doubt you'll get much help here for an unsupported Django version, especially since you are trying to integrate with a heavy third-party package.

-James

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/37905c1e-7a22-4f2f-84f6-ed3afa86eebd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lianghong Xu

unread,
Oct 19, 2015, 1:31:17 PM10/19/15
to Django users
Hi,

I was able to fix the problem by applying the patch here:


Thanks,
Lianghong
Reply all
Reply to author
Forward
0 new messages