无法登录django管理面板

时间:2017-11-27 12:29:02

标签: django django-admin django-admin-actions

在制作中,输入用户名和密码以访问django管理面板后,网站会出现以下错误'OperationalError at / admin / login / 无法打开数据库文件'

这是我的db.sqlite3

的设置
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}
# BASE_DIR => /var/www/name_of_website/src where db.sqlite3 stored

到目前为止,我已将db.sqlite3的读/写模式更改为 -rw-rw-rw -

这是我的apache日志文件 的 /var/log/apache/error.log

[Mon Nov 27 12:16:26.737719 2017] [wsgi:error] [pid 13974] Traceback (most recent call last):
[Mon Nov 27 12:16:26.737724 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 65, in execute
[Mon Nov 27 12:16:26.737728 2017] [wsgi:error] [pid 13974]     return self.cursor.execute(sql, params)
[Mon Nov 27 12:16:26.737733 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/db/backends/sqlite3/base.py", line 328, in execute
[Mon Nov 27 12:16:26.737737 2017] [wsgi:error] [pid 13974]     return Database.Cursor.execute(self, query, params)
[Mon Nov 27 12:16:26.737740 2017] [wsgi:error] [pid 13974] sqlite3.OperationalError: unable to open database file
[Mon Nov 27 12:16:26.737744 2017] [wsgi:error] [pid 13974] 
[Mon Nov 27 12:16:26.737747 2017] [wsgi:error] [pid 13974] The above exception was the direct cause of the following exception:
[Mon Nov 27 12:16:26.737751 2017] [wsgi:error] [pid 13974] 
[Mon Nov 27 12:16:26.737754 2017] [wsgi:error] [pid 13974] Traceback (most recent call last):
[Mon Nov 27 12:16:26.737758 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/exception.py", line 41, in inner
[Mon Nov 27 12:16:26.737761 2017] [wsgi:error] [pid 13974]     response = get_response(request)
[Mon Nov 27 12:16:26.737765 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py", line 187, in _get_response
[Mon Nov 27 12:16:26.737769 2017] [wsgi:error] [pid 13974]     response = self.process_exception_by_middleware(e, request)
[Mon Nov 27 12:16:26.737772 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py", line 185, in _get_response
[Mon Nov 27 12:16:26.737776 2017] [wsgi:error] [pid 13974]     response = wrapped_callback(request, *callback_args, **callback_kwargs)
[Mon Nov 27 12:16:26.737779 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/views/decorators/cache.py", line 57, in _wrapped_view_func
[Mon Nov 27 12:16:26.737783 2017] [wsgi:error] [pid 13974]     response = view_func(request, *args, **kwargs)
[Mon Nov 27 12:16:26.737786 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/contrib/admin/sites.py", line 393, in login
[Mon Nov 27 12:16:26.737790 2017] [wsgi:error] [pid 13974]     return LoginView.as_view(**defaults)(request)
[Mon Nov 27 12:16:26.737793 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/views/generic/base.py", line 68, in view
[Mon Nov 27 12:16:26.737797 2017] [wsgi:error] [pid 13974]     return self.dispatch(request, *args, **kwargs)
[Mon Nov 27 12:16:26.737800 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/utils/decorators.py", line 67, in _wrapper
[Mon Nov 27 12:16:26.737803 2017] [wsgi:error] [pid 13974]     return bound_func(*args, **kwargs)
[Mon Nov 27 12:16:26.737807 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/views/decorators/debug.py", line 76, in sensitive_post_parameters_wrapper
[Mon Nov 27 12:16:26.737810 2017] [wsgi:error] [pid 13974]     return view(request, *args, **kwargs)
[Mon Nov 27 12:16:26.737847 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/utils/decorators.py", line 63, in bound_func
[Mon Nov 27 12:16:26.737852 2017] [wsgi:error] [pid 13974]     return func.__get__(self, type(self))(*args2, **kwargs2)
[Mon Nov 27 12:16:26.737856 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/utils/decorators.py", line 67, in _wrapper
[Mon Nov 27 12:16:26.737859 2017] [wsgi:error] [pid 13974]     return bound_func(*args, **kwargs)
[Mon Nov 27 12:16:26.737862 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/utils/decorators.py", line 149, in _wrapped_view
[Mon Nov 27 12:16:26.737865 2017] [wsgi:error] [pid 13974]     response = view_func(request, *args, **kwargs)
[Mon Nov 27 12:16:26.737869 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/utils/decorators.py", line 63, in bound_func
[Mon Nov 27 12:16:26.737872 2017] [wsgi:error] [pid 13974]     return func.__get__(self, type(self))(*args2, **kwargs2)
[Mon Nov 27 12:16:26.737875 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/utils/decorators.py", line 67, in _wrapper
[Mon Nov 27 12:16:26.737878 2017] [wsgi:error] [pid 13974]     return bound_func(*args, **kwargs)
[Mon Nov 27 12:16:26.737881 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/views/decorators/cache.py", line 57, in _wrapped_view_func
[Mon Nov 27 12:16:26.737884 2017] [wsgi:error] [pid 13974]     response = view_func(request, *args, **kwargs)
[Mon Nov 27 12:16:26.737887 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/utils/decorators.py", line 63, in bound_func
[Mon Nov 27 12:16:26.737891 2017] [wsgi:error] [pid 13974]     return func.__get__(self, type(self))(*args2, **kwargs2)
[Mon Nov 27 12:16:26.737894 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/views.py", line 90, in dispatch
[Mon Nov 27 12:16:26.737897 2017] [wsgi:error] [pid 13974]     return super(LoginView, self).dispatch(request, *args, **kwargs)
[Mon Nov 27 12:16:26.737900 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/views/generic/base.py", line 88, in dispatch
[Mon Nov 27 12:16:26.737903 2017] [wsgi:error] [pid 13974]     return handler(request, *args, **kwargs)
[Mon Nov 27 12:16:26.737906 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/views/generic/edit.py", line 183, in post
[Mon Nov 27 12:16:26.737910 2017] [wsgi:error] [pid 13974]     return self.form_valid(form)
[Mon Nov 27 12:16:26.737913 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/views.py", line 119, in form_valid
[Mon Nov 27 12:16:26.737916 2017] [wsgi:error] [pid 13974]     auth_login(self.request, form.get_user())
[Mon Nov 27 12:16:26.737919 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/__init__.py", line 139, in login
[Mon Nov 27 12:16:26.737922 2017] [wsgi:error] [pid 13974]     request.session.cycle_key()
[Mon Nov 27 12:16:26.737925 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/contrib/sessions/backends/base.py", line 311, in cycle_key
[Mon Nov 27 12:16:26.737928 2017] [wsgi:error] [pid 13974]     self.create()
[Mon Nov 27 12:16:26.737931 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/contrib/sessions/backends/db.py", line 54, in create
[Mon Nov 27 12:16:26.737935 2017] [wsgi:error] [pid 13974]     self.save(must_create=True)
[Mon Nov 27 12:16:26.737938 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/contrib/sessions/backends/db.py", line 87, in save
[Mon Nov 27 12:16:26.737941 2017] [wsgi:error] [pid 13974]     obj.save(force_insert=must_create, force_update=not must_create, using=using)
[Mon Nov 27 12:16:26.737944 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 808, in save
[Mon Nov 27 12:16:26.737958 2017] [wsgi:error] [pid 13974]     force_update=force_update, update_fields=update_fields)
[Mon Nov 27 12:16:26.737962 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 838, in save_base
[Mon Nov 27 12:16:26.737965 2017] [wsgi:error] [pid 13974]     updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
[Mon Nov 27 12:16:26.737969 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 924, in _save_table
[Mon Nov 27 12:16:26.737972 2017] [wsgi:error] [pid 13974]     result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
[Mon Nov 27 12:16:26.737975 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 963, in _do_insert
[Mon Nov 27 12:16:26.737978 2017] [wsgi:error] [pid 13974]     using=using, raw=raw)
[Mon Nov 27 12:16:26.737982 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/db/models/manager.py", line 85, in manager_method
[Mon Nov 27 12:16:26.737985 2017] [wsgi:error] [pid 13974]     return getattr(self.get_queryset(), name)(*args, **kwargs)
[Mon Nov 27 12:16:26.737988 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/db/models/query.py", line 1076, in _insert
[Mon Nov 27 12:16:26.737991 2017] [wsgi:error] [pid 13974]     return query.get_compiler(using=using).execute_sql(return_id)
[Mon Nov 27 12:16:26.737994 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/db/models/sql/compiler.py", line 1107, in execute_sql
[Mon Nov 27 12:16:26.737997 2017] [wsgi:error] [pid 13974]     cursor.execute(sql, params)
[Mon Nov 27 12:16:26.738000 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 80, in execute
[Mon Nov 27 12:16:26.738004 2017] [wsgi:error] [pid 13974]     return super(CursorDebugWrapper, self).execute(sql, params)
[Mon Nov 27 12:16:26.738007 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 65, in execute
[Mon Nov 27 12:16:26.738010 2017] [wsgi:error] [pid 13974]     return self.cursor.execute(sql, params)
[Mon Nov 27 12:16:26.738013 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/db/utils.py", line 94, in __exit__
[Mon Nov 27 12:16:26.738016 2017] [wsgi:error] [pid 13974]     six.reraise(dj_exc_type, dj_exc_value, traceback)
[Mon Nov 27 12:16:26.738019 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/utils/six.py", line 685, in reraise
[Mon Nov 27 12:16:26.738022 2017] [wsgi:error] [pid 13974]     raise value.with_traceback(tb)
[Mon Nov 27 12:16:26.738025 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 65, in execute
[Mon Nov 27 12:16:26.738028 2017] [wsgi:error] [pid 13974]     return self.cursor.execute(sql, params)
[Mon Nov 27 12:16:26.738031 2017] [wsgi:error] [pid 13974]   File "/usr/local/lib/python3.5/dist-packages/django/db/backends/sqlite3/base.py", line 328, in execute
[Mon Nov 27 12:16:26.738035 2017] [wsgi:error] [pid 13974]     return Database.Cursor.execute(self, query, params)
[Mon Nov 27 12:16:26.738041 2017] [wsgi:error] [pid 13974] django.db.utils.OperationalError: unable to open database file
[Mon Nov 27 12:16:26.738054 2017] [wsgi:error] [pid 13974] 

0 个答案:

没有答案