aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Pipfile8
-rw-r--r--Pipfile.lock46
-rw-r--r--pysite/settings.py37
3 files changed, 69 insertions, 22 deletions
diff --git a/Pipfile b/Pipfile
index 08a51954..603eac40 100644
--- a/Pipfile
+++ b/Pipfile
@@ -6,6 +6,8 @@ name = "pypi"
[packages]
django = "*"
django-hosts = "*"
+django-environ = "*"
+"psycopg2-binary" = "*"
[dev-packages]
"flake8" = "*"
@@ -23,22 +25,16 @@ python_version = "3.7"
build = "docker build -t pythondiscord/site:latest -f docker/Dockerfile ."
buildci = "docker build -t pythondiscord/site-ci:latest -f docker/ci.Dockerfile ."
buildbase = "docker build -t pythondiscord/site-base:latest -f docker/Dockerfile.base ."
-
buildjs = "gulp"
#buildscss = "python scss.py scss/pysite:scss/pysite/style.scss:static/css/style.css scss/uikit:scss/uikit/uikit_blurple.scss:static/css/uikit_blurple.css"
-
clean = "rm -rf __pycache__ htmlcov .coverage .pytest_cache"
fixjs = "eslint static/js --fix"
#start = "gunicorn -w 12 -b 0.0.0.0:10012 -c gunicorn_config.py --log-level info -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker app:app"
-
lint = "python -m flake8"
lintjs = "eslint js/src"
lintscss = "scss-lint scss/pysite"
-
push = "docker push pythondiscord/site:latest"
pushbase = "docker push pythondiscord/site-base:latest"
pushci = "docker push pythondiscord/site-ci:latest"
-
#rundev = "python app.py"
#test = "py.test tests --cov pysite --cov-report term-missing -v"
-
diff --git a/Pipfile.lock b/Pipfile.lock
index 6567ef95..b30d530a 100644
--- a/Pipfile.lock
+++ b/Pipfile.lock
@@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
- "sha256": "d002ebbb384d9d2782cb4843616ec47687d188787612e8f4dab3e700ce25571e"
+ "sha256": "8abe5b868e4f260356132c8cc56dc52bd748a06de24ed040583d45a8b8de86f4"
},
"pipfile-spec": 6,
"requires": {
@@ -24,6 +24,14 @@
"index": "pypi",
"version": "==2.1"
},
+ "django-environ": {
+ "hashes": [
+ "sha256:6c9d87660142608f63ec7d5ce5564c49b603ea8ff25da595fd6098f6dc82afde",
+ "sha256:c57b3c11ec1f319d9474e3e5a79134f40174b17c7cc024bbb2fad84646b120c4"
+ ],
+ "index": "pypi",
+ "version": "==0.4.5"
+ },
"django-hosts": {
"hashes": [
"sha256:3599645f37b4c51df6140d659bef356e05ae7ff7748f8fef14c2c84083dd8089",
@@ -32,6 +40,42 @@
"index": "pypi",
"version": "==3.0"
},
+ "psycopg2-binary": {
+ "hashes": [
+ "sha256:04afb59bbbd2eab3148e6816beddc74348078b8c02a1113ea7f7822f5be4afe3",
+ "sha256:098b18f4d8857a8f9b206d1dc54db56c2255d5d26458917e7bcad61ebfe4338f",
+ "sha256:0bf855d4a7083e20ead961fda4923887094eaeace0ab2d76eb4aa300f4bbf5bd",
+ "sha256:197dda3ffd02057820be83fe4d84529ea70bf39a9a4daee1d20ffc74eb3d042e",
+ "sha256:278ef63afb4b3d842b4609f2c05ffbfb76795cf6a184deeb8707cd5ed3c981a5",
+ "sha256:3cbf8c4fc8f22f0817220891cf405831559f4d4c12c4f73913730a2ea6c47a47",
+ "sha256:4305aed922c4d9d6163ab3a41d80b5a1cfab54917467da8168552c42cad84d32",
+ "sha256:47ee296f704fb8b2a616dec691cdcfd5fa0f11943955e88faa98cbd1dc3b3e3d",
+ "sha256:4a0e38cb30457e70580903367161173d4a7d1381eb2f2cfe4e69b7806623f484",
+ "sha256:4d6c294c6638a71cafb82a37f182f24321f1163b08b5d5ca076e11fe838a3086",
+ "sha256:4f3233c366500730f839f92833194fd8f9a5c4529c8cd8040aa162c3740de8e5",
+ "sha256:5221f5a3f4ca2ddf0d58e8b8a32ca50948be9a43351fda797eb4e72d7a7aa34d",
+ "sha256:5c6ca0b507540a11eaf9e77dee4f07c131c2ec80ca0cffa146671bf690bc1c02",
+ "sha256:789bd89d71d704db2b3d5e67d6d518b158985d791d3b2dec5ab85457cfc9677b",
+ "sha256:7b94d29239efeaa6a967f3b5971bd0518d2a24edd1511edbf4a2c8b815220d07",
+ "sha256:89bc65ef3301c74cf32db25334421ea6adbe8f65601ea45dcaaf095abed910bb",
+ "sha256:89d6d3a549f405c20c9ae4dc94d7ed2de2fa77427a470674490a622070732e62",
+ "sha256:97521704ac7127d7d8ba22877da3c7bf4a40366587d238ec679ff38e33177498",
+ "sha256:a395b62d5f44ff6f633231abe568e2203b8fabf9797cd6386aa92497df912d9a",
+ "sha256:a6d32c37f714c3f34158f3fa659f3a8f2658d5f53c4297d45579b9677cc4d852",
+ "sha256:a89ee5c26f72f2d0d74b991ce49e42ddeb4ac0dc2d8c06a0f2770a1ab48f4fe0",
+ "sha256:b4c8b0ef3608e59317bfc501df84a61e48b5445d45f24d0391a24802de5f2d84",
+ "sha256:b5fcf07140219a1f71e18486b8dc28e2e1b76a441c19374805c617aa6d9a9d55",
+ "sha256:b86f527f00956ecebad6ab3bb30e3a75fedf1160a8716978dd8ce7adddedd86f",
+ "sha256:be4c4aa22ba22f70de36c98b06480e2f1697972d49eb20d525f400d204a6d272",
+ "sha256:c2ac7aa1a144d4e0e613ac7286dae85671e99fe7a1353954d4905629c36b811c",
+ "sha256:de26ef4787b5e778e8223913a3e50368b44e7480f83c76df1f51d23bd21cea16",
+ "sha256:e70ebcfc5372dc7b699c0110454fc4263967f30c55454397e5769eb72c0eb0ce",
+ "sha256:eadbd32b6bc48b67b0457fccc94c86f7ccc8178ab839f684eb285bb592dc143e",
+ "sha256:ecbc6dfff6db06b8b72ae8a2f25ff20fbdcb83cb543811a08f7cb555042aa729"
+ ],
+ "index": "pypi",
+ "version": "==2.7.5"
+ },
"pytz": {
"hashes": [
"sha256:a061aa0a9e06881eb8b3b2b43f05b9439d6583c206d0a6c340ff72a7b6669053",
diff --git a/pysite/settings.py b/pysite/settings.py
index fc705db6..1a31d215 100644
--- a/pysite/settings.py
+++ b/pysite/settings.py
@@ -12,15 +12,28 @@ https://docs.djangoproject.com/en/2.1/ref/settings/
import os
+import environ
+
+
+env = environ.Env(
+ DEBUG=(bool, False)
+)
+
+
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+DEBUG = env('DEBUG')
+
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
-SECRET_KEY = os.getenv("SECRET_KEY", "+_x00w3e94##2-qm-v(5&-x_@*l3t9zlir1etu+7$@4%!it2##")
+if DEBUG:
+ SECRET_KEY = "+_x00w3e94##2-qm-v(5&-x_@*l3t9zlir1etu+7$@4%!it2##"
+else:
+ SECRET_KEY = env('SECRET_KEY')
ALLOWED_HOSTS = ["pythondiscord.com"]
@@ -80,10 +93,7 @@ WSGI_APPLICATION = "pysite.wsgi.application"
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
DATABASES = {
- "default": {
- "ENGINE": "django.db.backends.sqlite3",
- "NAME": os.path.join(BASE_DIR, "db.sqlite3"),
- }
+ "default": env.db()
}
@@ -125,15 +135,12 @@ USE_TZ = True
STATIC_URL = "/static/"
-# Custom settings
-
-DEBUG = False
-DEFAULT_HOST = "main"
-PARENT_HOST = "pythondiscord.com"
+# django-hosts
+# https://django-hosts.readthedocs.io/en/latest/
+ROOT_HOSTCONF = "pysite.hosts"
+DEFAULT_HOST = 'main'
-if os.getenv("DEBUG") is not None: # Debug mode
- ALLOWED_HOSTS = ["pythondiscord.local"]
- DEBUG = True
+if DEBUG:
PARENT_HOST = "pythondiscord.local:8000"
-
-ROOT_HOSTCONF = "pysite.hosts"
+else:
+ PARENT_HOST = "pythondiscord.com"