django-fobi/examples/simple/settings/docker.py
2023-09-30 23:37:06 +02:00

106 lines
2.8 KiB
Python

from chromedriver_py import binary_path
from selenium import webdriver
from .bootstrap3_theme import *
from .bootstrap5_theme import *
def project_dir(base):
return os.path.abspath(
os.path.join(os.path.dirname(__file__), base).replace("\\", "/")
)
def gettext(s):
return s
PROJECT_DIR = project_dir
DEBUG = True
DEBUG_TOOLBAR = True
DEBUG_TEMPLATE = True
# TEMPLATE_DEBUG = True
DEV = True
POSTGRES_ENGINE = "django.db.backends.postgresql"
DATABASES = {
"default": {
"ENGINE": POSTGRES_ENGINE,
"HOST": "postgresql",
"NAME": "fobi",
"USER": "postgres",
"PASSWORD": "test",
}
}
TEST_DATABASES = {
"default": {
"ENGINE": POSTGRES_ENGINE,
"HOST": "postgresql",
"NAME": "fobi",
"USER": "postgres",
"PASSWORD": "test",
}
}
# FeinCMS addons
INSTALLED_APPS += [
"feincms", # FeinCMS
"fobi.contrib.apps.feincms_integration", # Fobi FeinCMS app
"page", # Example
]
MIGRATION_MODULES = {
"fobi": "fobi.migrations",
"db_store": "fobi.contrib.plugins.form_handlers.db_store.migrations",
"page": "page.migrations",
}
INTERNAL_IPS = ["127.0.0.1",]
if DEBUG:
# A better way to get the IP address?
# import subprocess
# cmd = ['hostname', '-I']
# result = subprocess.run(cmd, capture_output=True, text=True)
# return result.stdout.strip()
import socket # only if you haven't already imported this
hostname, _, ips = socket.gethostbyname_ex(socket.gethostname())
INTERNAL_IPS = [ip[: ip.rfind(".")] + ".1" for ip in ips] + ["127.0.0.1", "10.0.2.2", "10.89.0.3"]
ALLOWED_HOSTS = ["*"]
EMAIL_BACKEND = "django.core.mail.backends.filebased.EmailBackend"
EMAIL_FILE_PATH = PROJECT_DIR("../../tmp")
FOBI_DEBUG = True
FOBI_RESTRICT_PLUGIN_ACCESS = False
FOBI_RESTRICT_FIELDS_ACCESS = False
FOBI_FORM_ELEMENT_SELECT_MODEL_OBJECT_IGNORED_MODELS = ["auth.User"]
FOBI_FAIL_ON_MISSING_FORM_ELEMENT_PLUGINS = True
# FOBI_FAIL_ON_MISSING_FORM_HANDLER_PLUGINS = False
FOBI_FAIL_ON_ERRORS_IN_FORM_HANDLER_PLUGINS = True
# FOBI_DEFAULT_THEME = 'foundation5'
FOBI_FAIL_ON_MISSING_FORM_HANDLER_PLUGINS = True
FOBI_FAIL_ON_MISSING_FORM_WIZARD_HANDLER_PLUGINS = True
FOBI_FAIL_ON_ERRORS_IN_FORM_ELEMENT_PLUGINS = False
# FOBI_FAIL_ON_ERRORS_IN_FORM_HANDLER_PLUGINS = True
FOBI_FAIL_ON_ERRORS_IN_FORM_WIZARD_HANDLER_PLUGINS = True
# WAIT_BETWEEN_TEST_STEPS = 0
# FOBI_WAIT_AT_TEST_END = False
ENABLE_CAPTCHA = True
CHROME_DRIVER_OPTIONS = webdriver.ChromeOptions()
CHROME_DRIVER_OPTIONS.add_argument("-headless")
CHROME_DRIVER_OPTIONS.add_argument("-no-sandbox")
CHROME_DRIVER_OPTIONS.set_capability("chrome.binary", "/usr/bin/google-chrome")
# CHROME_DRIVER_OPTIONS.add_argument('-single-process')
CHROME_DRIVER_EXECUTABLE_PATH = binary_path # '/usr/bin/chromedriver'
FIREFOX_BIN_PATH = "/usr/lib/firefox/firefox"
PHANTOM_JS_EXECUTABLE_PATH = ""