Improve settings

The commit removes the non-existing sys.path import, simplifies the
condition in the show_debug_toolbar function and defines ALLOWED_HOSTS
for the test environment.
This commit is contained in:
Jan Dittberner 2019-07-05 21:25:31 +02:00
parent 977189c263
commit e487dad026

View file

@ -6,7 +6,6 @@ Common settings and globals.
""" """
from os.path import abspath, basename, dirname, join, normpath from os.path import abspath, basename, dirname, join, normpath
from sys import path
from django.contrib.messages import constants as messages from django.contrib.messages import constants as messages
@ -23,9 +22,6 @@ SITE_ROOT = dirname(DJANGO_ROOT)
# Site name: # Site name:
SITE_NAME = basename(DJANGO_ROOT) SITE_NAME = basename(DJANGO_ROOT)
# Add our project to our pythonpath, this way we don't need to type our project
# name in our dotted import paths:
path.append(DJANGO_ROOT)
# ######### END PATH CONFIGURATION # ######### END PATH CONFIGURATION
@ -363,7 +359,7 @@ STATIC_ROOT = "/srv/gnuviechadmin/static/"
def show_debug_toolbar(request): def show_debug_toolbar(request):
return DEBUG == True and GVA_ENVIRONMENT == "local" return DEBUG and GVA_ENVIRONMENT == "local"
if GVA_ENVIRONMENT == "local": if GVA_ENVIRONMENT == "local":
@ -431,6 +427,7 @@ if GVA_ENVIRONMENT == "local":
# ######### END TOOLBAR CONFIGURATION # ######### END TOOLBAR CONFIGURATION
elif GVA_ENVIRONMENT == "test": elif GVA_ENVIRONMENT == "test":
ALLOWED_HOSTS = ["localhost"]
PASSWORD_HASHERS = ("django.contrib.auth.hashers.MD5PasswordHasher",) PASSWORD_HASHERS = ("django.contrib.auth.hashers.MD5PasswordHasher",)
LOGGING["handlers"].update( LOGGING["handlers"].update(
{ {