· 8 years ago · Sep 26, 2017, 02:40 AM
1ValueError at /accounts/login/
2Couldn't load 'Argon2PasswordHasher' algorithm library: No module named argon2
3
4"""
5Django settings for django_project project.
6
7Generated by 'django-admin startproject' using Django 1.8.7.
8
9For more information on this file, see
10https://docs.djangoproject.com/en/1.8/topics/settings/
11
12For the full list of settings and their values, see
13https://docs.djangoproject.com/en/1.8/ref/settings/
14"""
15
16# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
17import os
18
19BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
20TEMPLATE_DIR = os.path.join(BASE_DIR, 'templates')
21MEDIA_DIR = os.path.join(BASE_DIR, 'media')
22
23
24# Quick-start development settings - unsuitable for production
25# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
26
27# SECURITY WARNING: keep the secret key used in production secret!
28SECRET_KEY = 'h&*(yq942_a^pa+ty&wh(bl9s4d#z^*_6cmeb#5&49jb^r$&!f'
29
30# SECURITY WARNING: don't run with debug turned on in production!
31DEBUG = True
32
33ALLOWED_HOSTS = []
34
35
36# Application definition
37
38INSTALLED_APPS = (
39 'django.contrib.admin',
40 'django.contrib.auth',
41 'django.contrib.contenttypes',
42 'django.contrib.sessions',
43 'django.contrib.messages',
44 'django.contrib.staticfiles',
45 'django.contrib.sites',
46
47 'users',
48 'feed',
49 'blog',
50
51 'allauth',
52 'allauth.account',
53 'allauth.socialaccount',
54)
55
56MIDDLEWARE_CLASSES = (
57 'django.contrib.sessions.middleware.SessionMiddleware',
58 'django.middleware.common.CommonMiddleware',
59 'django.middleware.csrf.CsrfViewMiddleware',
60 'django.contrib.auth.middleware.AuthenticationMiddleware',
61 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
62 'django.contrib.messages.middleware.MessageMiddleware',
63 'django.middleware.clickjacking.XFrameOptionsMiddleware',
64 'django.middleware.security.SecurityMiddleware',
65)
66
67ROOT_URLCONF = 'django_project.urls'
68
69TEMPLATES = [
70 {
71 'BACKEND': 'django.template.backends.django.DjangoTemplates',
72 'DIRS': [],
73 'APP_DIRS': True,
74 'OPTIONS': {
75 'context_processors': [
76 'django.template.context_processors.debug',
77 'django.template.context_processors.request',
78 'django.contrib.auth.context_processors.auth',
79 'django.contrib.messages.context_processors.messages',
80 ],
81 },
82 },
83]
84
85WSGI_APPLICATION = 'django_project.wsgi.application'
86
87
88# Database
89# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
90
91DATABASES = {
92 'default': {
93 'ENGINE': 'django.db.backends.sqlite3',
94 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
95 }
96}
97
98# Password validation
99# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
100
101PASSWORD_HASHERS = [
102 'django.contrib.auth.hashers.Argon2PasswordHasher',
103 'django.contrib.auth.hashers.BCryptSHA256PasswordHasher',
104 'django.contrib.auth.hashers.BCryptPasswordHasher',
105 'django.contrib.auth.hashers.PBKDF2PasswordHasher',
106 'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
107]
108
109
110# Internationalization
111# https://docs.djangoproject.com/en/1.8/topics/i18n/
112
113LANGUAGE_CODE = 'en-us'
114
115TIME_ZONE = 'UTC'
116
117USE_I18N = True
118
119USE_L10N = True
120
121USE_TZ = True
122
123SITE_ID = 1
124
125
126# Static files (CSS, JavaScript, Images)
127# https://docs.djangoproject.com/en/1.8/howto/static-files/
128
129STATIC_URL = '/static/'
130STATIC_ROOT = '/static/'
131STATIC_DIR = os.path.join(BASE_DIR,'static')
132
133STATICFILES_DIRS = [
134 STATIC_DIR,
135]
136
137
138#MEDIA
139MEDIA_ROOT = MEDIA_DIR
140MEDIA_URL = '/media/'
141
142
143LOGIN_URL = '/user_login'
144
145# settings
146ACCOUNT_AUTHENTICATION_METHOD = 'username_email'
147
148ACCOUNT_USERNAME_REQUIRED = True
149ACCOUNT_UNIQUE_USERNAME =True
150ACCOUNT_SIGNUP_EMAIL_ENTER_TWICE =False
151ACCOUNT_SIGNUP_PASSWORD_ENTER_TWICE =True
152ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS =3
153ACCOUNT_LOGIN_ATTEMPTS_LIMIT = 5
154ACCOUNT_LOGOUT_ON_PASSWORD_CHANGE =True
155ACCOUNT_SESSION_REMEMBER =None
156ACCOUNT_ADAPTER ='allauth.account.adapter.DefaultAccountAdapter'
157
158ACCOUNT_UNIQUE_EMAIL =True
159# SOCIALACCOUNT_AUTO_SIGNUP =True
160
161# SOCIALACCOUNT_EMAIL_REQUIRED ='ACCOUNT_EMAIL_REQUIRED'
162# SOCIALACCOUNT_QUERY_EMAIL ='ACCOUNT_EMAIL_REQUIRED'
163
164
165ACCOUNT_EMAIL_REQUIRED = True
166ACCOUNT_EMAIL_CONFIRMATION_HMAC =True
167ACCOUNT_EMAIL_VERIFICATION = 'none'
168#ACCOUNT_EMAIL_VERIFICATION = 'optional'
169#ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
170
171
172EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
173EMAIL_HOST = 'smtp.sendgrid.com'
174EMAIL_HOST_PASSWORD = 'password'
175EMAIL_HOST_USER = 'username'
176EMAIL_PORT = 587
177EMAIL_USE_TLS = True
178DEFAULT_FROM_EMAIL = 'support@yoursite.com'
179
180
181
182# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
183# Allow Django from all hosts. This snippet is installed from
184# /var/lib/digitalocean/allow_hosts.py
185
186import os
187import netifaces
188
189# Find out what the IP addresses are at run time
190# This is necessary because otherwise Gunicorn will reject the connections
191def ip_addresses():
192 ip_list = []
193 for interface in netifaces.interfaces():
194 addrs = netifaces.ifaddresses(interface)
195 for x in (netifaces.AF_INET, netifaces.AF_INET6):
196 if x in addrs:
197 ip_list.append(addrs[x][0]['addr'])
198 return ip_list
199
200# Discover our IP address
201ALLOWED_HOSTS = ip_addresses()
202
203Traceback Switch to copy-and-paste view
204
205/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py in inner
206 response = get_response(request) ...
207â–¶ Local vars
208/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py in _legacy_get_response
209 response = self._get_response(request) ...
210â–¶ Local vars
211/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py in _get_response
212 response = self.process_exception_by_middleware(e, request) ...
213â–¶ Local vars
214/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py in _get_response
215 response = wrapped_callback(request, *callback_args, **callback_kwargs) ...
216â–¶ Local vars
217/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py in view
218 return self.dispatch(request, *args, **kwargs) ...
219â–¶ Local vars
220/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py in _wrapper
221 return bound_func(*args, **kwargs) ...
222â–¶ Local vars
223/usr/local/lib/python2.7/dist-packages/django/views/decorators/debug.py in sensitive_post_parameters_wrapper
224 return view(request, *args, **kwargs) ...
225â–¶ Local vars
226/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py in bound_func
227 return func.__get__(self, type(self))(*args2, **kwargs2) ...
228â–¶ Local vars
229/home/django/django_project/allauth/account/views.py in dispatch
230 return super(LoginView, self).dispatch(request, *args, **kwargs) ...
231â–¶ Local vars
232/home/django/django_project/allauth/account/views.py in dispatch
233 **kwargs) ...
234â–¶ Local vars
235/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py in dispatch
236 return handler(request, *args, **kwargs) ...
237â–¶ Local vars
238/home/django/django_project/allauth/account/views.py in post
239 if form.is_valid(): ...
240â–¶ Local vars
241/usr/local/lib/python2.7/dist-packages/django/forms/forms.py in is_valid
242 return self.is_bound and not self.errors ...
243â–¶ Local vars
244/usr/local/lib/python2.7/dist-packages/django/forms/forms.py in errors
245 self.full_clean() ...
246â–¶ Local vars
247/usr/local/lib/python2.7/dist-packages/django/forms/forms.py in full_clean
248 self._clean_form() ...
249â–¶ Local vars
250/usr/local/lib/python2.7/dist-packages/django/forms/forms.py in _clean_form
251 cleaned_data = self.clean() ...
252â–¶ Local vars
253/home/django/django_project/allauth/account/forms.py in clean
254 **credentials) ...
255â–¶ Local vars
256/home/django/django_project/allauth/account/adapter.py in authenticate
257 user = authenticate(request=request, **credentials) ...
258â–¶ Local vars
259/home/django/django_project/allauth/compat.py in authenticate
260 return authenticate(request=request, **credentials) ...
261â–¶ Local vars
262/usr/local/lib/python2.7/dist-packages/django/contrib/auth/__init__.py in authenticate
263 user = _authenticate_with_backend(backend, backend_path, request, credentials) ...
264â–¶ Local vars
265/usr/local/lib/python2.7/dist-packages/django/contrib/auth/__init__.py in _authenticate_with_backend
266 return backend.authenticate(*args, **credentials) ...
267â–¶ Local vars
268/usr/local/lib/python2.7/dist-packages/django/contrib/auth/backends.py in authenticate
269 if user.check_password(password) and self.user_can_authenticate(user): ...
270â–¶ Local vars
271/usr/local/lib/python2.7/dist-packages/django/contrib/auth/base_user.py in check_password
272 return check_password(raw_password, self.password, setter) ...
273â–¶ Local vars
274/usr/local/lib/python2.7/dist-packages/django/contrib/auth/hashers.py in check_password
275 must_update = hasher_changed or preferred.must_update(encoded) ...
276â–¶ Local vars
277/usr/local/lib/python2.7/dist-packages/django/contrib/auth/hashers.py in must_update
278 argon2 = self._load_library() ...
279â–¶ Local vars
280/usr/local/lib/python2.7/dist-packages/django/contrib/auth/hashers.py in _load_library
281 (self.__class__.__name__, e)) ...
282â–¶ Local vars