2011-07-31 34 views
6

ứng dụng django của tôi chạy với mysql, nhưng khi tôi cố gắng với MongoDB sau đó hiển thị lỗi thieDjango MongoDB vấn đề

Traceback (most recent call last): 
    File "manage.py", line 14, in <module> 
    execute_manager(settings) 
    File "/home/abdullah/django-trunk/django/core/management/__init__.py", line 442, in execute_manager 
    utility.execute() 
    File "/home/abdullah/django-trunk/django/core/management/__init__.py", line 379, in execute 
    self.fetch_command(subcommand).run_from_argv(self.argv) 
    File "/home/abdullah/django-trunk/django/core/management/base.py", line 191, in run_from_argv 
    self.execute(*args, **options.__dict__) 
    File "/home/abdullah/django-trunk/django/core/management/base.py", line 209, in execute 
    translation.activate('en-us') 
    File "/home/abdullah/django-trunk/django/utils/translation/__init__.py", line 106, in activate 
    return _trans.activate(language) 
    File "/home/abdullah/django-trunk/django/utils/translation/trans_real.py", line 191, in activate 
    _active.value = translation(language) 
    File "/home/abdullah/django-trunk/django/utils/translation/trans_real.py", line 180, in translation 
    default_translation = _fetch(settings.LANGUAGE_CODE) 
    File "/home/abdullah/django-trunk/django/utils/translation/trans_real.py", line 157, in _fetch 
    app = import_module(appname) 
    File "/home/abdullah/django-trunk/django/utils/importlib.py", line 35, in import_module 
    __import__(name) 
    File "/home/abdullah/django-trunk/django/contrib/admin/__init__.py", line 3, in <module> 
    from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME 
    File "/home/abdullah/django-trunk/django/contrib/admin/helpers.py", line 2, in <module> 
    from django.contrib.admin.util import (flatten_fieldsets, lookup_field, 
    File "/home/abdullah/django-trunk/django/contrib/admin/util.py", line 1, in <module> 
    from django.db import models 
    File "/home/abdullah/django-trunk/django/db/__init__.py", line 27, in <module> 
    connection = connections[DEFAULT_DB_ALIAS] 
    File "/home/abdullah/django-trunk/django/db/utils.py", line 82, in __getitem__ 
    conn = backend.DatabaseWrapper(db, alias) 
    File "/usr/local/lib/python2.6/dist-packages/django_mongodb_engine-0.4.0-py2.6.egg/django_mongodb_engine/base.py", line 87, in __init__ 
    self.ops = DatabaseOperations(self) 
    File "/usr/local/lib/python2.6/dist-packages/djangotoolbox-0.9.2-py2.6.egg/djangotoolbox/db/base.py", line 28, in __init__ 
    super(NonrelDatabaseOperations, self).__init__() 
TypeError: __init__() takes exactly 2 arguments (1 given) 

** Tôi đã cài đặt tất cả các mô-đun cần thiết được cài đặt, nhưng khi tôi muốn runserver sau đó hiển thị thông điệp này

+0

tôi m có cùng một vấn đề. Đoán tốt nhất của tôi cho đến nay là nó có cái gì để làm với các phiên bản không tương thích của django-mongodb và djangotoolbox - bất cứ ai có bất cứ hiểu biết? –

Trả lời

9

tôi quản lý để sửa chữa các lỗi tương tự bằng cách sử dụng những gói trên github:

https://github.com/django-nonrel/django-nonrel 
https://github.com/django-nonrel/djangotoolbox 

thay vì những khuyến cáo trên trang cài đặt Django-MongoDB của. Ngoài ra, hãy đảm bảo sử dụng chi nhánh master của từng loại, để không gặp sự cố tương thích. Nếu bạn đang sử dụng pip, bạn có thể pip install mỗi dòng sau riêng biệt, hoặc đặt chúng vào các phiên bản của một tập tin requirements.txt cho dự án của bạn:

git+https://github.com/django-nonrel/[email protected] 
git+https://github.com/django-nonrel/[email protected] 
git+https://github.com/django-nonrel/[email protected] 

Và sau đó chạy

pip install -r requirements.txt 
+0

đã làm việc cho tôi :) –

+0

Cảm ơn bạn, đã giúp tôi rất nhiều! –

+0

Tôi vẫn nhận được lỗi tương tự. – Burak

Các vấn đề liên quan