我刚刚设置了我的服务器并上传了amy Django项目的所有文件。我目前正在调试它给我的所有错误,我遇到了这个,我以前从未见过,而且似乎无法找到:
OperationalError at /accounts/login/ attempt to write a readonly database
我理解它意味着什么,我只是不知道如何修复它,也不知道它为什么会发生。我正在使用Digital Ocean Droplet作为我的服务器。我刚刚获得主页(登录页面)工作,登录后我遇到了这个。
这是追溯:
Traceback Switch to copy-and-paste view
/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py in inner
response = get_response(request) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py in _legacy_get_response
response = self._get_response(request) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py in _get_response
response = self.process_exception_by_middleware(e, request) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py in view
return self.dispatch(request, *args, **kwargs) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py in _wrapper
return bound_func(*args, **kwargs) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/views/decorators/debug.py in sensitive_post_parameters_wrapper
return view(request, *args, **kwargs) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py in bound_func
return func.__get__(self, type(self))(*args2, **kwargs2) ...
▶ Local vars
/home/django/django_project/allauth/account/views.py in dispatch
return super(LoginView, self).dispatch(request, *args, **kwargs) ...
▶ Local vars
/home/django/django_project/allauth/account/views.py in dispatch
**kwargs) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py in dispatch
return handler(request, *args, **kwargs) ...
▶ Local vars
/home/django/django_project/allauth/account/views.py in post
response = self.form_valid(form) ...
▶ Local vars
/home/django/django_project/allauth/account/views.py in form_valid
return form.login(self.request, redirect_url=success_url) ...
▶ Local vars
/home/django/django_project/allauth/account/forms.py in login
redirect_url=redirect_url) ...
▶ Local vars
/home/django/django_project/allauth/account/utils.py in perform_login
adapter.login(request, user) ...
▶ Local vars
/home/django/django_project/allauth/account/adapter.py in login
django_login(request, user) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/contrib/auth/__init__.py in login
request.session.cycle_key() ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/contrib/sessions/backends/base.py in cycle_key
self.create() ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/contrib/sessions/backends/db.py in create
self.save(must_create=True) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/contrib/sessions/backends/db.py in save
obj.save(force_insert=must_create, force_update=not must_create, using=using) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/models/base.py in save
force_update=force_update, update_fields=update_fields) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/models/base.py in save_base
updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/models/base.py in _save_table
result = self._do_insert(cls._base_manager, using, fields, update_pk, raw) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/models/base.py in _do_insert
using=using, raw=raw) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/models/query.py in _insert
return query.get_compiler(using=using).execute_sql(return_id) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py in execute_sql
cursor.execute(sql, params) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py in execute
return super(CursorDebugWrapper, self).execute(sql, params) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py in execute
return self.cursor.execute(sql, params) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/utils.py in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py in execute
return self.cursor.execute(sql, params) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py in execute
return Database.Cursor.execute(self, query, params) ...
▶ Local vars
答案 0 :(得分:0)
授予数据库文件的写入权限
sudo chmod a+w db.sqlite3