1
0
mirror of https://github.com/TandoorRecipes/recipes.git synced 2026-01-11 09:07:12 -05:00

fixed wsgi error

This commit is contained in:
smilerz
2021-09-28 15:45:54 -05:00
parent 39255c93a5
commit b7b0b9c690
3 changed files with 18 additions and 16 deletions

View File

@@ -73,7 +73,8 @@ ACCOUNT_SIGNUP_FORM_CLASS = 'cookbook.forms.AllAuthSignupForm'
TERMS_URL = os.getenv('TERMS_URL', '')
PRIVACY_URL = os.getenv('PRIVACY_URL', '')
IMPRINT_URL = os.getenv('IMPRINT_URL', '')
SORT_TREE_BY_NAME = os.getenv('IMPRINT_URL', 1)
if SORT_TREE_BY_NAME:= bool(int(os.getenv('SQL_DEBUG', True))):
MIDDLEWARE += ('recipes.middleware.SqlPrintingMiddleware',)
HOSTED = bool(int(os.getenv('HOSTED', False)))
@@ -391,5 +392,3 @@ EMAIL_USE_SSL = bool(int(os.getenv('EMAIL_USE_SSL', False)))
DEFAULT_FROM_EMAIL = os.getenv('DEFAULT_FROM_EMAIL', 'webmaster@localhost')
ACCOUNT_EMAIL_SUBJECT_PREFIX = os.getenv('ACCOUNT_EMAIL_SUBJECT_PREFIX', '[Tandoor Recipes] ') # allauth sender prefix
if os.getenv('SQL_DEBUG', False):
MIDDLEWARE += ('recipes.middleware.SqlPrintingMiddleware',)

View File

@@ -8,20 +8,10 @@ https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
from django_scopes import scopes_disabled
from cookbook.models import Food, Keyword
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "recipes.settings")
# run fix tree here solves 2 problems:
# 1 if tree sorting is changed from unsorted to sorted ensures that objects are sorted
# 2 if any condition caused the tree to be in an inconsistent state this will fix most problems
with scopes_disabled():
Food.fix_tree(fix_paths=True)
Keyword.fix_tree(fix_paths=True)
_application = get_wsgi_application()