from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/ # https://docs.djangoproject.com/en/dev/ref/settings/#secret-key # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = "django-insecure-0peo@#x9jur3!h$ryje!$879xww8y1y66jx!%*#ymhg&jkozs2" # https://docs.djangoproject.com/en/dev/ref/settings/#debug # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True # https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts ALLOWED_HOSTS = ["localhost", "0.0.0.0", "127.0.0.1", "pocket-trade-dev.fly.dev"] # Application definition # https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps INSTALLED_APPS = [ "django_daisy", "django.contrib.admin", "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sessions", "django.contrib.messages", "whitenoise.runserver_nostatic", "django.contrib.staticfiles", "django.contrib.sites", "allauth", "allauth.account", 'allauth.socialaccount.providers.google', "crispy_forms", "crispy_bootstrap5", "debug_toolbar", "el_pagination", "tailwind", "theme", "django_browser_reload", "accounts", "cards", "home", "trades.apps.TradesConfig", "friend_codes" ] TAILWIND_APP_NAME = 'theme' # https://docs.djangoproject.com/en/dev/ref/settings/#middleware MIDDLEWARE = [ "django.middleware.security.SecurityMiddleware", "whitenoise.middleware.WhiteNoiseMiddleware", # WhiteNoise "django.contrib.sessions.middleware.SessionMiddleware", "django.middleware.common.CommonMiddleware", "debug_toolbar.middleware.DebugToolbarMiddleware", # Django Debug Toolbar "django.middleware.csrf.CsrfViewMiddleware", "django.contrib.auth.middleware.AuthenticationMiddleware", "django.contrib.messages.middleware.MessageMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware", "allauth.account.middleware.AccountMiddleware", # django-allauth "django_browser_reload.middleware.BrowserReloadMiddleware", "django_project.middleware.AutoLoginMiddleware", ] DAISY_SETTINGS = { 'SITE_TITLE': 'Pocket.Trade Admin', 'DONT_SUPPORT_ME': True, } # https://docs.djangoproject.com/en/dev/ref/settings/#root-urlconf ROOT_URLCONF = "django_project.urls" # https://docs.djangoproject.com/en/dev/ref/settings/#wsgi-application WSGI_APPLICATION = "django_project.wsgi.application" # https://docs.djangoproject.com/en/dev/ref/settings/#templates TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", #"DIRS": [BASE_DIR / "templates"], "DIRS": [BASE_DIR / "theme", BASE_DIR / "templates"], "APP_DIRS": True, "OPTIONS": { "context_processors": [ "django.template.context_processors.debug", "django.template.context_processors.request", "django.contrib.auth.context_processors.auth", "django.contrib.messages.context_processors.messages", ], }, }, ] # https://docs.djangoproject.com/en/dev/ref/settings/#databases #DATABASES = { # "default": { # "ENGINE": "django.db.backends.sqlite3", # "NAME": BASE_DIR / "db.sqlite3", # } #} # For Docker/PostgreSQL usage uncomment this and comment the DATABASES config above DATABASES = { "default": { "ENGINE": "django.db.backends.postgresql", "NAME": "postgres", "USER": "postgres", "PASSWORD": "postgres", "HOST": "db", # set in docker-compose.yml "PORT": 5432, # default postgres port }, "neon": { "ENGINE": "django.db.backends.postgresql", "NAME": "pocket-trade", "USER": "pocket_trade_owner", "PASSWORD": "npg_f1lTpOX7Rnvb", "HOST": "ep-cool-cake-a6zvgu85-pooler.us-west-2.aws.neon.tech", # set in docker-compose.yml "PORT": 5432, # default postgres port "OPTIONS": { "sslmode": "require" }, } } # Password validation # https://docs.djangoproject.com/en/dev/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", }, { "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", }, { "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", }, { "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator", }, ] # Internationalization # https://docs.djangoproject.com/en/dev/topics/i18n/ # https://docs.djangoproject.com/en/dev/ref/settings/#language-code LANGUAGE_CODE = "en-us" # https://docs.djangoproject.com/en/dev/ref/settings/#time-zone TIME_ZONE = "UTC" # https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-USE_I18N USE_I18N = True # https://docs.djangoproject.com/en/dev/ref/settings/#use-tz USE_TZ = True # https://docs.djangoproject.com/en/dev/ref/settings/#locale-paths LOCALE_PATHS = [BASE_DIR / 'locale'] # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/5.0/howto/static-files/ # https://docs.djangoproject.com/en/dev/ref/settings/#static-root STATIC_ROOT = BASE_DIR / "staticfiles" # https://docs.djangoproject.com/en/dev/ref/settings/#static-url STATIC_URL = "/static/" # https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS STATICFILES_DIRS = [BASE_DIR / "static"] # https://whitenoise.readthedocs.io/en/latest/django.html STORAGES = { "default": { "BACKEND": "django.core.files.storage.FileSystemStorage", }, "staticfiles": { "BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage", }, } # Default primary key field type # https://docs.djangoproject.com/en/stable/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' # django-crispy-forms # https://django-crispy-forms.readthedocs.io/en/latest/install.html#template-packs CRISPY_ALLOWED_TEMPLATE_PACKS = 'bootstrap5' CRISPY_TEMPLATE_PACK = "bootstrap5" # https://docs.djangoproject.com/en/dev/ref/settings/#email-backend EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" # https://docs.djangoproject.com/en/dev/ref/settings/#default-from-email DEFAULT_FROM_EMAIL = "root@localhost" # django-debug-toolbar # https://django-debug-toolbar.readthedocs.io/en/latest/installation.html # https://docs.djangoproject.com/en/dev/ref/settings/#internal-ips import socket hostname, _, ips = socket.gethostbyname_ex(socket.gethostname()) INTERNAL_IPS = [ip[:-1] + "1" for ip in ips] # https://docs.djangoproject.com/en/dev/topics/auth/customizing/#substituting-a-custom-user-model AUTH_USER_MODEL = "accounts.CustomUser" # django-allauth config # https://docs.djangoproject.com/en/dev/ref/settings/#site-id SITE_ID = 1 # https://docs.djangoproject.com/en/dev/ref/settings/#login-redirect-url LOGIN_REDIRECT_URL = "home" # https://django-allauth.readthedocs.io/en/latest/views.html#logout-account-logout ACCOUNT_LOGOUT_REDIRECT_URL = "home" # https://django-allauth.readthedocs.io/en/latest/installation.html?highlight=backends AUTHENTICATION_BACKENDS = ( "django.contrib.auth.backends.ModelBackend", "allauth.account.auth_backends.AuthenticationBackend", ) # https://django-allauth.readthedocs.io/en/latest/configuration.html ACCOUNT_SESSION_REMEMBER = True ACCOUNT_SIGNUP_PASSWORD_ENTER_TWICE = False ACCOUNT_USERNAME_REQUIRED = False ACCOUNT_AUTHENTICATION_METHOD = "email" ACCOUNT_EMAIL_REQUIRED = True #ACCOUNT_EMAIL_VERIFICATION = "mandatory" ACCOUNT_EMAIL_VERIFICATION = "none" ACCOUNT_CHANGE_EMAIL = True ACCOUNT_UNIQUE_EMAIL = True ACCOUNT_SIGNUP_FORM_HONEYPOT_FIELD = "friend_code" SOCIALACCOUNT_EMAIL_AUTHENTICATION = True SOCIALACCOUNT_EMAIL_AUTHENTICATION_AUTO_CONNECT = True SOCIALACCOUNT_ONLY = False # SOCIALACCOUNT_PROVIDERS = { # "google": { # # For each OAuth based provider, either add a ``SocialApp`` # # (``socialaccount`` app) containing the required client # # credentials, or list them here: # "APPS": [ # { # "client_id": "123", # "secret": "456", # "key": "" # }, # ], # # These are provider-specific settings that can only be # # listed here: # "SCOPE": [ # "profile", # "email", # ], # "AUTH_PARAMS": { # "access_type": "offline", # }, # }, # "openid_connect": { # # Optional PKCE defaults to False, but may be required by your provider # # Applies to all APPS. # "OAUTH_PKCE_ENABLED": True, # "APPS": [ # { # "provider_id": "nintendo", # "name": "Nintendo Account", # "client_id": "your.service.id", # "secret": "your.service.secret", # "settings": { # "server_url": "https://my.server.example.com", # # Optional token endpoint authentication method. # # May be one of "client_secret_basic", "client_secret_post" # # If omitted, a method from the the server's # # token auth methods list is used # "token_auth_method": "client_secret_basic", # }, # }, # ] # } # } if DEBUG: CACHES = { "default": { "BACKEND": "django.core.cache.backends.dummy.DummyCache", } } else: CACHES = { "default": { "BACKEND": "django.core.cache.backends.locmem.LocMemCache", "LOCATION": "unique-snowflake", } }