Add local settings to Git
This commit is contained in:
parent
a73f852e39
commit
c54b3e5412
1
.gitignore
vendored
1
.gitignore
vendored
@ -58,7 +58,6 @@ cover/
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
|
@ -1,35 +0,0 @@
|
||||
# URLs
|
||||
DOMAIN = "example.com"
|
||||
URL = f"https://{DOMAIN}"
|
||||
|
||||
# Access control
|
||||
ALLOWED_HOSTS = ["127.0.0.1", DOMAIN]
|
||||
|
||||
# CSRF
|
||||
CSRF_TRUSTED_ORIGINS = [URL]
|
||||
|
||||
# Stripe
|
||||
STRIPE_TEST = True
|
||||
STRIPE_API_KEY_TEST = ""
|
||||
STRIPE_PUBLIC_API_KEY_TEST = ""
|
||||
|
||||
STRIPE_API_KEY_PROD = ""
|
||||
STRIPE_PUBLIC_API_KEY_PROD = ""
|
||||
|
||||
STRIPE_ENDPOINT_SECRET = ""
|
||||
STATIC_ROOT = ""
|
||||
SECRET_KEY = "a"
|
||||
|
||||
STRIPE_ADMIN_COUPON = ""
|
||||
|
||||
DEBUG = True
|
||||
PROFILER = False
|
||||
|
||||
if DEBUG:
|
||||
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",
|
||||
]
|
42
app/local_settings.py
Normal file
42
app/local_settings.py
Normal file
@ -0,0 +1,42 @@
|
||||
from os import getenv
|
||||
|
||||
trues = ("t", "true", "yes", "y", "1")
|
||||
|
||||
# URLs
|
||||
DOMAIN = getenv("DOMAIN", "example.com")
|
||||
URL = getenv("URL", f"https://{DOMAIN}")
|
||||
|
||||
# Access control
|
||||
ALLOWED_HOSTS = getenv("ALLOWED_HOSTS", f"127.0.0.1,{DOMAIN}").split(",")
|
||||
|
||||
# CSRF
|
||||
CSRF_TRUSTED_ORIGINS = getenv("CSRF_TRUSTED_ORIGINS", URL).split(",")
|
||||
|
||||
# Stripe
|
||||
STRIPE_ENABLED = getenv("STRIPE_ENABLED", "false").lower() in trues
|
||||
STRIPE_TEST = getenv("STRIPE_TEST", "true") in trues
|
||||
STRIPE_API_KEY_TEST = getenv("STRIPE_API_KEY_TEST", "")
|
||||
STRIPE_PUBLIC_API_KEY_TEST = getenv("STRIPE_PUBLIC_API_KEY_TEST", "")
|
||||
|
||||
STRIPE_API_KEY_PROD = getenv("STRIPE_API_KEY_PROD", "")
|
||||
STRIPE_PUBLIC_API_KEY_PROD = getenv("STRIPE_PUBLIC_API_KEY_PROD", "")
|
||||
|
||||
STRIPE_ENDPOINT_SECRET = getenv("STRIPE_ENDPOINT_SECRET", "")
|
||||
STATIC_ROOT = getenv("STATIC_ROOT", "")
|
||||
SECRET_KEY = getenv("SECRET_KEY", "")
|
||||
|
||||
STRIPE_ADMIN_COUPON = getenv("STRIPE_ADMIN_COUPON", "")
|
||||
|
||||
DEBUG = getenv("DEBUG", "false") in trues
|
||||
PROFILER = getenv("PROFILER", "false") in trues
|
||||
|
||||
if DEBUG:
|
||||
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",
|
||||
]
|
||||
|
||||
SETTINGS_EXPORT = ["STRIPE_ENABLED"]
|
Loading…
Reference in New Issue
Block a user