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

Merge branch 'develop' into ldap

This commit is contained in:
Perjéssy Lóránt
2021-10-16 19:32:06 +02:00
278 changed files with 50890 additions and 22824 deletions

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-08-12 15:09+0200\n"
"POT-Creation-Date: 2021-09-13 22:40+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -18,42 +18,42 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: .\recipes\settings.py:317
#: .\recipes\settings.py:324
msgid "Armenian "
msgstr ""
#: .\recipes\settings.py:318
#: .\recipes\settings.py:325
msgid "Catalan"
msgstr ""
#: .\recipes\settings.py:319
#: .\recipes\settings.py:326
msgid "Czech"
msgstr ""
#: .\recipes\settings.py:320
#: .\recipes\settings.py:327
msgid "Dutch"
msgstr ""
#: .\recipes\settings.py:321
#: .\recipes\settings.py:328
msgid "English"
msgstr ""
#: .\recipes\settings.py:322
#: .\recipes\settings.py:329
msgid "French"
msgstr ""
#: .\recipes\settings.py:323
#: .\recipes\settings.py:330
msgid "German"
msgstr ""
#: .\recipes\settings.py:324
#: .\recipes\settings.py:331
msgid "Italian"
msgstr ""
#: .\recipes\settings.py:325
#: .\recipes\settings.py:332
msgid "Latvian"
msgstr ""
#: .\recipes\settings.py:326
#: .\recipes\settings.py:333
msgid "Spanish"
msgstr ""

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-08-12 15:09+0200\n"
"POT-Creation-Date: 2021-09-13 22:40+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -18,42 +18,42 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: .\recipes\settings.py:317
#: .\recipes\settings.py:324
msgid "Armenian "
msgstr ""
#: .\recipes\settings.py:318
#: .\recipes\settings.py:325
msgid "Catalan"
msgstr ""
#: .\recipes\settings.py:319
#: .\recipes\settings.py:326
msgid "Czech"
msgstr ""
#: .\recipes\settings.py:320
#: .\recipes\settings.py:327
msgid "Dutch"
msgstr ""
#: .\recipes\settings.py:321
#: .\recipes\settings.py:328
msgid "English"
msgstr "Englisch"
#: .\recipes\settings.py:322
#: .\recipes\settings.py:329
msgid "French"
msgstr ""
#: .\recipes\settings.py:323
#: .\recipes\settings.py:330
msgid "German"
msgstr "Deutsch"
#: .\recipes\settings.py:324
#: .\recipes\settings.py:331
msgid "Italian"
msgstr ""
#: .\recipes\settings.py:325
#: .\recipes\settings.py:332
msgid "Latvian"
msgstr ""
#: .\recipes\settings.py:326
#: .\recipes\settings.py:333
msgid "Spanish"
msgstr ""

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-08-12 15:09+0200\n"
"POT-Creation-Date: 2021-09-13 22:40+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -18,42 +18,42 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: .\recipes\settings.py:317
#: .\recipes\settings.py:324
msgid "Armenian "
msgstr ""
#: .\recipes\settings.py:318
#: .\recipes\settings.py:325
msgid "Catalan"
msgstr ""
#: .\recipes\settings.py:319
#: .\recipes\settings.py:326
msgid "Czech"
msgstr ""
#: .\recipes\settings.py:320
#: .\recipes\settings.py:327
msgid "Dutch"
msgstr ""
#: .\recipes\settings.py:321
#: .\recipes\settings.py:328
msgid "English"
msgstr ""
#: .\recipes\settings.py:322
#: .\recipes\settings.py:329
msgid "French"
msgstr ""
#: .\recipes\settings.py:323
#: .\recipes\settings.py:330
msgid "German"
msgstr ""
#: .\recipes\settings.py:324
#: .\recipes\settings.py:331
msgid "Italian"
msgstr ""
#: .\recipes\settings.py:325
#: .\recipes\settings.py:332
msgid "Latvian"
msgstr ""
#: .\recipes\settings.py:326
#: .\recipes\settings.py:333
msgid "Spanish"
msgstr ""

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-08-12 15:09+0200\n"
"POT-Creation-Date: 2021-09-13 22:40+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -18,42 +18,42 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: .\recipes\settings.py:317
#: .\recipes\settings.py:324
msgid "Armenian "
msgstr ""
#: .\recipes\settings.py:318
#: .\recipes\settings.py:325
msgid "Catalan"
msgstr ""
#: .\recipes\settings.py:319
#: .\recipes\settings.py:326
msgid "Czech"
msgstr ""
#: .\recipes\settings.py:320
#: .\recipes\settings.py:327
msgid "Dutch"
msgstr ""
#: .\recipes\settings.py:321
#: .\recipes\settings.py:328
msgid "English"
msgstr ""
#: .\recipes\settings.py:322
#: .\recipes\settings.py:329
msgid "French"
msgstr ""
#: .\recipes\settings.py:323
#: .\recipes\settings.py:330
msgid "German"
msgstr ""
#: .\recipes\settings.py:324
#: .\recipes\settings.py:331
msgid "Italian"
msgstr ""
#: .\recipes\settings.py:325
#: .\recipes\settings.py:332
msgid "Latvian"
msgstr ""
#: .\recipes\settings.py:326
#: .\recipes\settings.py:333
msgid "Spanish"
msgstr ""

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-08-12 15:09+0200\n"
"POT-Creation-Date: 2021-09-13 22:40+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -18,42 +18,42 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: .\recipes\settings.py:317
#: .\recipes\settings.py:324
msgid "Armenian "
msgstr ""
#: .\recipes\settings.py:318
#: .\recipes\settings.py:325
msgid "Catalan"
msgstr ""
#: .\recipes\settings.py:319
#: .\recipes\settings.py:326
msgid "Czech"
msgstr ""
#: .\recipes\settings.py:320
#: .\recipes\settings.py:327
msgid "Dutch"
msgstr ""
#: .\recipes\settings.py:321
#: .\recipes\settings.py:328
msgid "English"
msgstr ""
#: .\recipes\settings.py:322
#: .\recipes\settings.py:329
msgid "French"
msgstr ""
#: .\recipes\settings.py:323
#: .\recipes\settings.py:330
msgid "German"
msgstr ""
#: .\recipes\settings.py:324
#: .\recipes\settings.py:331
msgid "Italian"
msgstr ""
#: .\recipes\settings.py:325
#: .\recipes\settings.py:332
msgid "Latvian"
msgstr ""
#: .\recipes\settings.py:326
#: .\recipes\settings.py:333
msgid "Spanish"
msgstr ""

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-08-12 15:09+0200\n"
"POT-Creation-Date: 2021-09-13 22:40+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,42 +17,42 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: .\recipes\settings.py:317
#: .\recipes\settings.py:324
msgid "Armenian "
msgstr ""
#: .\recipes\settings.py:318
#: .\recipes\settings.py:325
msgid "Catalan"
msgstr ""
#: .\recipes\settings.py:319
#: .\recipes\settings.py:326
msgid "Czech"
msgstr ""
#: .\recipes\settings.py:320
#: .\recipes\settings.py:327
msgid "Dutch"
msgstr ""
#: .\recipes\settings.py:321
#: .\recipes\settings.py:328
msgid "English"
msgstr ""
#: .\recipes\settings.py:322
#: .\recipes\settings.py:329
msgid "French"
msgstr ""
#: .\recipes\settings.py:323
#: .\recipes\settings.py:330
msgid "German"
msgstr ""
#: .\recipes\settings.py:324
#: .\recipes\settings.py:331
msgid "Italian"
msgstr ""
#: .\recipes\settings.py:325
#: .\recipes\settings.py:332
msgid "Latvian"
msgstr ""
#: .\recipes\settings.py:326
#: .\recipes\settings.py:333
msgid "Spanish"
msgstr ""

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-08-12 15:09+0200\n"
"POT-Creation-Date: 2021-09-13 22:40+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -18,42 +18,42 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: .\recipes\settings.py:317
#: .\recipes\settings.py:324
msgid "Armenian "
msgstr ""
#: .\recipes\settings.py:318
#: .\recipes\settings.py:325
msgid "Catalan"
msgstr ""
#: .\recipes\settings.py:319
#: .\recipes\settings.py:326
msgid "Czech"
msgstr ""
#: .\recipes\settings.py:320
#: .\recipes\settings.py:327
msgid "Dutch"
msgstr ""
#: .\recipes\settings.py:321
#: .\recipes\settings.py:328
msgid "English"
msgstr ""
#: .\recipes\settings.py:322
#: .\recipes\settings.py:329
msgid "French"
msgstr ""
#: .\recipes\settings.py:323
#: .\recipes\settings.py:330
msgid "German"
msgstr ""
#: .\recipes\settings.py:324
#: .\recipes\settings.py:331
msgid "Italian"
msgstr ""
#: .\recipes\settings.py:325
#: .\recipes\settings.py:332
msgid "Latvian"
msgstr ""
#: .\recipes\settings.py:326
#: .\recipes\settings.py:333
msgid "Spanish"
msgstr ""

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-08-12 15:09+0200\n"
"POT-Creation-Date: 2021-09-13 22:40+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -19,42 +19,42 @@ msgstr ""
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : "
"2);\n"
#: .\recipes\settings.py:317
#: .\recipes\settings.py:324
msgid "Armenian "
msgstr ""
#: .\recipes\settings.py:318
#: .\recipes\settings.py:325
msgid "Catalan"
msgstr ""
#: .\recipes\settings.py:319
#: .\recipes\settings.py:326
msgid "Czech"
msgstr ""
#: .\recipes\settings.py:320
#: .\recipes\settings.py:327
msgid "Dutch"
msgstr ""
#: .\recipes\settings.py:321
#: .\recipes\settings.py:328
msgid "English"
msgstr ""
#: .\recipes\settings.py:322
#: .\recipes\settings.py:329
msgid "French"
msgstr ""
#: .\recipes\settings.py:323
#: .\recipes\settings.py:330
msgid "German"
msgstr ""
#: .\recipes\settings.py:324
#: .\recipes\settings.py:331
msgid "Italian"
msgstr ""
#: .\recipes\settings.py:325
#: .\recipes\settings.py:332
msgid "Latvian"
msgstr ""
#: .\recipes\settings.py:326
#: .\recipes\settings.py:333
msgid "Spanish"
msgstr ""

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-08-12 15:09+0200\n"
"POT-Creation-Date: 2021-09-13 22:40+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -18,42 +18,42 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: .\recipes\settings.py:317
#: .\recipes\settings.py:324
msgid "Armenian "
msgstr ""
#: .\recipes\settings.py:318
#: .\recipes\settings.py:325
msgid "Catalan"
msgstr ""
#: .\recipes\settings.py:319
#: .\recipes\settings.py:326
msgid "Czech"
msgstr ""
#: .\recipes\settings.py:320
#: .\recipes\settings.py:327
msgid "Dutch"
msgstr ""
#: .\recipes\settings.py:321
#: .\recipes\settings.py:328
msgid "English"
msgstr ""
#: .\recipes\settings.py:322
#: .\recipes\settings.py:329
msgid "French"
msgstr ""
#: .\recipes\settings.py:323
#: .\recipes\settings.py:330
msgid "German"
msgstr ""
#: .\recipes\settings.py:324
#: .\recipes\settings.py:331
msgid "Italian"
msgstr ""
#: .\recipes\settings.py:325
#: .\recipes\settings.py:332
msgid "Latvian"
msgstr ""
#: .\recipes\settings.py:326
#: .\recipes\settings.py:333
msgid "Spanish"
msgstr ""

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-08-12 15:09+0200\n"
"POT-Creation-Date: 2021-09-13 22:40+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -18,42 +18,42 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: .\recipes\settings.py:317
#: .\recipes\settings.py:324
msgid "Armenian "
msgstr ""
#: .\recipes\settings.py:318
#: .\recipes\settings.py:325
msgid "Catalan"
msgstr ""
#: .\recipes\settings.py:319
#: .\recipes\settings.py:326
msgid "Czech"
msgstr ""
#: .\recipes\settings.py:320
#: .\recipes\settings.py:327
msgid "Dutch"
msgstr ""
#: .\recipes\settings.py:321
#: .\recipes\settings.py:328
msgid "English"
msgstr ""
#: .\recipes\settings.py:322
#: .\recipes\settings.py:329
msgid "French"
msgstr ""
#: .\recipes\settings.py:323
#: .\recipes\settings.py:330
msgid "German"
msgstr ""
#: .\recipes\settings.py:324
#: .\recipes\settings.py:331
msgid "Italian"
msgstr ""
#: .\recipes\settings.py:325
#: .\recipes\settings.py:332
msgid "Latvian"
msgstr ""
#: .\recipes\settings.py:326
#: .\recipes\settings.py:333
msgid "Spanish"
msgstr ""

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-08-12 15:09+0200\n"
"POT-Creation-Date: 2021-09-13 22:40+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,42 +17,42 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: .\recipes\settings.py:317
#: .\recipes\settings.py:324
msgid "Armenian "
msgstr ""
#: .\recipes\settings.py:318
#: .\recipes\settings.py:325
msgid "Catalan"
msgstr ""
#: .\recipes\settings.py:319
#: .\recipes\settings.py:326
msgid "Czech"
msgstr ""
#: .\recipes\settings.py:320
#: .\recipes\settings.py:327
msgid "Dutch"
msgstr ""
#: .\recipes\settings.py:321
#: .\recipes\settings.py:328
msgid "English"
msgstr ""
#: .\recipes\settings.py:322
#: .\recipes\settings.py:329
msgid "French"
msgstr ""
#: .\recipes\settings.py:323
#: .\recipes\settings.py:330
msgid "German"
msgstr ""
#: .\recipes\settings.py:324
#: .\recipes\settings.py:331
msgid "Italian"
msgstr ""
#: .\recipes\settings.py:325
#: .\recipes\settings.py:332
msgid "Latvian"
msgstr ""
#: .\recipes\settings.py:326
#: .\recipes\settings.py:333
msgid "Spanish"
msgstr ""

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-08-12 15:09+0200\n"
"POT-Creation-Date: 2021-09-13 22:40+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -18,42 +18,42 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: .\recipes\settings.py:317
#: .\recipes\settings.py:324
msgid "Armenian "
msgstr ""
#: .\recipes\settings.py:318
#: .\recipes\settings.py:325
msgid "Catalan"
msgstr ""
#: .\recipes\settings.py:319
#: .\recipes\settings.py:326
msgid "Czech"
msgstr ""
#: .\recipes\settings.py:320
#: .\recipes\settings.py:327
msgid "Dutch"
msgstr ""
#: .\recipes\settings.py:321
#: .\recipes\settings.py:328
msgid "English"
msgstr ""
#: .\recipes\settings.py:322
#: .\recipes\settings.py:329
msgid "French"
msgstr ""
#: .\recipes\settings.py:323
#: .\recipes\settings.py:330
msgid "German"
msgstr ""
#: .\recipes\settings.py:324
#: .\recipes\settings.py:331
msgid "Italian"
msgstr ""
#: .\recipes\settings.py:325
#: .\recipes\settings.py:332
msgid "Latvian"
msgstr ""
#: .\recipes\settings.py:326
#: .\recipes\settings.py:333
msgid "Spanish"
msgstr ""

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-08-12 15:09+0200\n"
"POT-Creation-Date: 2021-09-13 22:40+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,42 +17,42 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: .\recipes\settings.py:317
#: .\recipes\settings.py:324
msgid "Armenian "
msgstr ""
#: .\recipes\settings.py:318
#: .\recipes\settings.py:325
msgid "Catalan"
msgstr ""
#: .\recipes\settings.py:319
#: .\recipes\settings.py:326
msgid "Czech"
msgstr ""
#: .\recipes\settings.py:320
#: .\recipes\settings.py:327
msgid "Dutch"
msgstr ""
#: .\recipes\settings.py:321
#: .\recipes\settings.py:328
msgid "English"
msgstr ""
#: .\recipes\settings.py:322
#: .\recipes\settings.py:329
msgid "French"
msgstr ""
#: .\recipes\settings.py:323
#: .\recipes\settings.py:330
msgid "German"
msgstr ""
#: .\recipes\settings.py:324
#: .\recipes\settings.py:331
msgid "Italian"
msgstr ""
#: .\recipes\settings.py:325
#: .\recipes\settings.py:332
msgid "Latvian"
msgstr ""
#: .\recipes\settings.py:326
#: .\recipes\settings.py:333
msgid "Spanish"
msgstr ""

View File

@@ -1,7 +1,71 @@
from os import getenv
from django.conf import settings
from django.contrib.auth.middleware import RemoteUserMiddleware
from django.db import connection
class CustomRemoteUser(RemoteUserMiddleware):
header = getenv('PROXY_HEADER', 'HTTP_REMOTE_USER')
"""
Gist code by vstoykov, you can check his original gist at:
https://gist.github.com/vstoykov/1390853/5d2e8fac3ca2b2ada8c7de2fb70c021e50927375
Changes:
Ignoring static file requests and a certain useless admin request from triggering the logger.
Updated statements to make it Python 3 friendly.
"""
def terminal_width():
"""
Function to compute the terminal width.
"""
width = 0
try:
import struct, fcntl, termios
s = struct.pack('HHHH', 0, 0, 0, 0)
x = fcntl.ioctl(1, termios.TIOCGWINSZ, s)
width = struct.unpack('HHHH', x)[1]
except:
pass
if width <= 0:
try:
width = int(getenv['COLUMNS'])
except:
pass
if width <= 0:
width = 80
return width
def SqlPrintingMiddleware(get_response):
def middleware(request):
response = get_response(request)
if (
not settings.DEBUG
or len(connection.queries) == 0
or request.path_info.startswith(settings.MEDIA_URL)
or '/admin/jsi18n/' in request.path_info
):
return response
indentation = 2
print("\n\n%s\033[1;35m[SQL Queries for]\033[1;34m %s\033[0m\n" % (" " * indentation, request.path_info))
width = terminal_width()
total_time = 0.0
for query in connection.queries:
nice_sql = query['sql'].replace('"', '').replace(',', ', ')
sql = "\033[1;31m[%s]\033[0m %s" % (query['time'], nice_sql)
total_time = total_time + float(query['time'])
while len(sql) > width - indentation:
#print("%s%s" % (" " * indentation, sql[:width - indentation]))
sql = sql[width - indentation:]
#print("%s%s\n" % (" " * indentation, sql))
replace_tuple = (" " * indentation, str(total_time))
print("%s\033[1;32m[TOTAL TIME: %s seconds]\033[0m" % replace_tuple)
print("%s\033[1;32m[TOTAL QUERIES: %s]\033[0m" % (" " * indentation, len(connection.queries)))
return response
return middleware

View File

@@ -12,16 +12,13 @@ https://docs.djangoproject.com/en/2.0/ref/settings/
import ast
import json
import os
import random
import re
import string
from django.contrib import messages
from django.contrib.staticfiles.storage import staticfiles_storage
from django.utils.translation import gettext_lazy as _
from dotenv import load_dotenv
from webpack_loader.loader import WebpackLoader
load_dotenv()
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Get vars from .env files
@@ -77,7 +74,6 @@ 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', '')
HOSTED = bool(int(os.getenv('HOSTED', False)))
MESSAGE_TAGS = {
@@ -102,7 +98,6 @@ INSTALLED_APPS = [
'corsheaders',
'django_filters',
'crispy_forms',
'emoji_picker',
'rest_framework',
'rest_framework.authtoken',
'django_cleanup.apps.CleanupConfig',
@@ -113,6 +108,7 @@ INSTALLED_APPS = [
'allauth.account',
'allauth.socialaccount',
'cookbook.apps.CookbookConfig',
'treebeard',
]
SOCIAL_PROVIDERS = os.getenv('SOCIAL_PROVIDERS').split(',') if os.getenv('SOCIAL_PROVIDERS') else []
@@ -153,6 +149,11 @@ MIDDLEWARE = [
'cookbook.helper.scope_middleware.ScopeMiddleware',
]
SORT_TREE_BY_NAME = bool(int(os.getenv('SORT_TREE_BY_NAME', False)))
if bool(int(os.getenv('SQL_DEBUG', False))):
MIDDLEWARE += ('recipes.middleware.SqlPrintingMiddleware',)
if ENABLE_METRICS:
MIDDLEWARE += 'django_prometheus.middleware.PrometheusAfterMiddleware',
@@ -295,7 +296,7 @@ else:
'USER': os.getenv('POSTGRES_USER'),
'PASSWORD': os.getenv('POSTGRES_PASSWORD'),
'NAME': os.getenv('POSTGRES_DB') if os.getenv('POSTGRES_DB') else 'db.sqlite3',
'CONN_MAX_AGE': 600,
'CONN_MAX_AGE': 60,
}
}
@@ -312,6 +313,16 @@ else:
# }
# }
# SQLite testing DB
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'OPTIONS': ast.literal_eval(os.getenv('DB_OPTIONS')) if os.getenv('DB_OPTIONS') else {},
# 'NAME': 'db.sqlite3',
# 'CONN_MAX_AGE': 600,
# }
# }
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',

View File

@@ -8,9 +8,27 @@ https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "recipes.settings")
application = get_wsgi_application()
_application = get_wsgi_application()
# allows proxy servers to serve application at a subfolder
# NGINX config example is included in nginx/conf.d
def application(environ, start_response):
# http://flask.pocoo.org/snippets/35/
script_name = environ.get('HTTP_X_SCRIPT_NAME', '')
if script_name:
environ['SCRIPT_NAME'] = script_name
path_info = environ['PATH_INFO']
if path_info.startswith(script_name):
environ['PATH_INFO'] = path_info[len(script_name):]
scheme = environ.get('HTTP_X_SCHEME', '')
if scheme:
environ['wsgi.url_scheme'] = scheme
return _application(environ, start_response)