Fix prospector errors and move secret_key to yaml config
This commit is contained in:
parent
7c7b3469e9
commit
cde35515c7
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
"""Django manage.py"""
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__fil
|
||||||
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
|
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
|
||||||
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
SECRET_KEY = '9$@r!d^1^jrn#fk#1#@ks#9&i$^s#1)_13%$rwjrhd=e8jfi_s'
|
SECRET_KEY = CONFIG.get('secret_key')
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
|
|
|
@ -29,6 +29,7 @@ secure_proxy_header:
|
||||||
redis: localhost
|
redis: localhost
|
||||||
# Error reporting, sends stacktrace to sentry.services.beryju.org
|
# Error reporting, sends stacktrace to sentry.services.beryju.org
|
||||||
error_report_enabled: true
|
error_report_enabled: true
|
||||||
|
secret_key: 9$@r!d^1^jrn#fk#1#@ks#9&i$^s#1)_13%$rwjrhd=e8jfi_s
|
||||||
|
|
||||||
passbook:
|
passbook:
|
||||||
sign_up:
|
sign_up:
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
|
|
||||||
from django import template
|
from django import template
|
||||||
from django.apps import AppConfig
|
|
||||||
from django.core.cache import cache
|
|
||||||
from django.urls import reverse
|
|
||||||
from django.urls.exceptions import NoReverseMatch
|
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
LOGGER = getLogger(__name__)
|
LOGGER = getLogger(__name__)
|
||||||
|
|
|
@ -145,10 +145,10 @@ def related_models(context, model_path):
|
||||||
user = request.user
|
user = request.user
|
||||||
|
|
||||||
model = path_to_class(model_path)
|
model = path_to_class(model_path)
|
||||||
if not issubclass(model, UserAcquirable):
|
# if not issubclass(model, UserAcquirable):
|
||||||
# model_path is not actually a module
|
# # model_path is not actually a module
|
||||||
# so we can't assume that it's usable
|
# # so we can't assume that it's usable
|
||||||
return []
|
# return []
|
||||||
|
|
||||||
return model.objects.filter(users__in=[user])
|
return model.objects.filter(users__in=[user])
|
||||||
|
|
||||||
|
@ -161,4 +161,5 @@ def unslug(_input):
|
||||||
|
|
||||||
@register.filter(name='css_class')
|
@register.filter(name='css_class')
|
||||||
def css_class(field, css):
|
def css_class(field, css):
|
||||||
|
"""Add css class to form field"""
|
||||||
return field.as_widget(attrs={"class": css})
|
return field.as_widget(attrs={"class": css})
|
||||||
|
|
|
@ -195,7 +195,7 @@ class OAuthCallback(OAuthClientMixin, View):
|
||||||
def handle_new_user(self, source, access, info):
|
def handle_new_user(self, source, access, info):
|
||||||
"Create a shell auth.User and redirect."
|
"Create a shell auth.User and redirect."
|
||||||
was_authenticated = False
|
was_authenticated = False
|
||||||
if self.request.user.is_authenticated: # pylint: disable=no-else-return
|
if self.request.user.is_authenticated:
|
||||||
# there's already a user logged in, just link them up
|
# there's already a user logged in, just link them up
|
||||||
user = self.request.user
|
user = self.request.user
|
||||||
was_authenticated = True
|
was_authenticated = True
|
||||||
|
|
Reference in New Issue