使用DO的Django一键安装并上传所有内容后出现此错误。我设置了我的设置和网址文件。我不确定问题是什么,我以前从未见过它。
错误:
OperationalError at /accounts/login/
SSL error: unknown protocol
expected authentication request from server, but received S
回溯:
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 get
request, *args, **kwargs) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/views/generic/edit.py in get
return self.render_to_response(self.get_context_data()) ...
▶ Local vars
/home/django/django_project/allauth/account/views.py in get_context_data
site = get_current_site(self.request) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/contrib/sites/shortcuts.py in get_current_site
return Site.objects.get_current(request) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/contrib/sites/models.py in get_current
return self._get_site_by_id(site_id) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/contrib/sites/models.py in _get_site_by_id
site = self.get(pk=site_id) ...
▶ 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 get
num = len(clone) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/models/query.py in __len__
self._fetch_all() ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/models/query.py in _fetch_all
self._result_cache = list(self._iterable_class(self)) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/models/query.py in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py in execute_sql
cursor = self.connection.cursor() ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/backends/base/base.py in cursor
return self._cursor() ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/backends/base/base.py in _cursor
self.ensure_connection() ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/backends/base/base.py in ensure_connection
self.connect() ...
▶ 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/base/base.py in ensure_connection
self.connect() ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/backends/base/base.py in connect
self.connection = self.get_new_connection(conn_params) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql/base.py in get_new_connection
connection = Database.connect(**conn_params) ...
▶ Local vars
/usr/lib/python2.7/dist-packages/psycopg2/__init__.py in connect
conn = _connect(dsn, connection_factory=connection_factory, async=async) ...
▶ Local vars
显然我不想得到这个错误,而只是让应用程序工作......我尝试将我的应用程序切换到postgresql进行部署,但它是在sqlite中开发的。我没有将任何迁移或数据库文件投入生产,我确保进行了新的迁移。
答案 0 :(得分:1)
因为本地主机和服务器上的django版本不匹配。
升级服务器上的django version
(数字海洋小滴)以匹配您在localhost中开发的那个。
默认情况下,他们在One-Click-Install中提供django-1.6
。你需要升级然后一切都会正常工作。
pip install --upgrade django