Django / admin在安装MySQL时尝试使用SQLite DB

时间:2014-04-22 01:45:32

标签: mysql django

新手。用Google搜索,什么也没看到。

试图进入管理员/它说:

    /usr/lib/python2.6/site-packages/django/db/backends/sqlite3/base.py in get_new_connection, line 346

[它试图使用SQLlite作为数据库]。

但我有MySQL作为数据库 - 以及使用MySQL正常工作的其他功能。 (它在添加新应用程序时更新MySQL数据库)。

我甚至手动检查了MySQL数据库,它有我添加的超级用户!

有人有什么想法吗?

环境:

完整堆栈跟踪:

Request Method: POST Request URL: ommitted/

Django Version: 1.6.2 Python Version: 2.6.6 Installed Applications: ('django.contrib.admin',  'django.contrib.auth',  'django.contrib.contenttypes',  'django.contrib.sessions',  'django.contrib.messages',  'django.contrib.staticfiles') Installed Middleware: ('django.contrib.sessions.middleware.SessionMiddleware',  'django.middleware.common.CommonMiddleware',  'django.middleware.csrf.CsrfViewMiddleware',  'django.contrib.auth.middleware.AuthenticationMiddleware',  'django.contrib.messages.middleware.MessageMiddleware',  'django.middleware.clickjacking.XFrameOptionsMiddleware')


Traceback: File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response
  114.                     response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/usr/lib/python2.6/site-packages/django/contrib/admin/sites.py" in wrapper
  215.                 return self.admin_view(view, cacheable)(*args, **kwargs) File "/usr/lib/python2.6/site-packages/django/utils/decorators.py" in
_wrapped_view
  99.                     response = view_func(request, *args, **kwargs) File "/usr/lib/python2.6/site-packages/django/views/decorators/cache.py" in
_wrapped_view_func
  52.         response = view_func(request, *args, **kwargs) File "/usr/lib/python2.6/site-packages/django/contrib/admin/sites.py" in inner
  197.                 return self.login(request) File "/usr/lib/python2.6/site-packages/django/views/decorators/cache.py" in
_wrapped_view_func
  52.         response = view_func(request, *args, **kwargs) File "/usr/lib/python2.6/site-packages/django/contrib/admin/sites.py" in login
  330.         return login(request, **defaults) File "/usr/lib/python2.6/site-packages/django/views/decorators/debug.py" in sensitive_post_parameters_wrapper
  75.             return view(request, *args, **kwargs) File "/usr/lib/python2.6/site-packages/django/utils/decorators.py" in
_wrapped_view
  99.                     response = view_func(request, *args, **kwargs) File "/usr/lib/python2.6/site-packages/django/views/decorators/cache.py" in
_wrapped_view_func
  52.         response = view_func(request, *args, **kwargs) File "/usr/lib/python2.6/site-packages/django/contrib/auth/views.py" in login
  36.         if form.is_valid(): File "/usr/lib/python2.6/site-packages/django/forms/forms.py" in is_valid
  129.         return self.is_bound and not bool(self.errors) File "/usr/lib/python2.6/site-packages/django/forms/forms.py" in errors
  121.             self.full_clean() File "/usr/lib/python2.6/site-packages/django/forms/forms.py" in full_clean
  274.         self._clean_form() File "/usr/lib/python2.6/site-packages/django/forms/forms.py" in
_clean_form
  300.             self.cleaned_data = self.clean() File "/usr/lib/python2.6/site-packages/django/contrib/admin/forms.py" in clean
  28.             self.user_cache = authenticate(username=username, password=password) File "/usr/lib/python2.6/site-packages/django/contrib/auth/__init__.py" in authenticate
  49.             user = backend.authenticate(**credentials) File "/usr/lib/python2.6/site-packages/django/contrib/auth/backends.py" in authenticate
  16.             user = UserModel._default_manager.get_by_natural_key(username) File "/usr/lib/python2.6/site-packages/django/contrib/auth/models.py" in get_by_natural_key
  167.         return self.get(**{self.model.USERNAME_FIELD: username}) File "/usr/lib/python2.6/site-packages/django/db/models/manager.py" in get
  151.         return self.get_queryset().get(*args, **kwargs) File "/usr/lib/python2.6/site-packages/django/db/models/query.py" in get
  301.         num = len(clone) File "/usr/lib/python2.6/site-packages/django/db/models/query.py" in
__len__
  77.         self._fetch_all() File "/usr/lib/python2.6/site-packages/django/db/models/query.py" in
_fetch_all
  854.             self._result_cache = list(self.iterator()) File "/usr/lib/python2.6/site-packages/django/db/models/query.py" in iterator
  220.         for row in compiler.results_iter(): File "/usr/lib/python2.6/site-packages/django/db/models/sql/compiler.py" in results_iter
  709.         for rows in self.execute_sql(MULTI): File "/usr/lib/python2.6/site-packages/django/db/models/sql/compiler.py" in execute_sql
  781.         cursor = self.connection.cursor() File "/usr/lib/python2.6/site-packages/django/db/backends/__init__.py" in cursor
  157.             cursor = self.make_debug_cursor(self._cursor()) File "/usr/lib/python2.6/site-packages/django/db/backends/__init__.py" in _cursor
  129.         self.ensure_connection() File "/usr/lib/python2.6/site-packages/django/db/backends/__init__.py" in ensure_connection
  124.                 self.connect() File "/usr/lib/python2.6/site-packages/django/db/utils.py" in __exit__
  99.                 six.reraise(dj_exc_type, dj_exc_value, traceback) File "/usr/lib/python2.6/site-packages/django/db/backends/__init__.py" in ensure_connection
  124.                 self.connect() File "/usr/lib/python2.6/site-packages/django/db/backends/__init__.py" in connect
  112.         self.connection = self.get_new_connection(conn_params) File "/usr/lib/python2.6/site-packages/django/db/backends/sqlite3/base.py" in get_new_connection
  346.         conn = Database.connect(**conn_params)

Exception Type: OperationalError at /admin/ Exception Value: unable to open database file

settings.py数据库设置:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'pymail',
        'USER': 'pymail',
        'PASSWORD': 'removed',
        'HOST': 'removed',
        'PORT': '3306',
    }
}

0 个答案:

没有答案