diff --git a/.gitignore b/.gitignore index 95698e0..a787360 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ -cc_env/ +.env +cc_env # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..bf06914 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: gunicorn confidencechronograms.wsgi --log-file - diff --git a/confidence_chronogram/settings.py b/confidence_chronogram/settings.py index bb8f2d0..70bfecc 100644 --- a/confidence_chronogram/settings.py +++ b/confidence_chronogram/settings.py @@ -12,6 +12,10 @@ import os +from decouple import config + +from dj_database_url import parse as dburl + # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -20,12 +24,11 @@ # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'lw+n1tz+u*5*mqapv^(bowb%ex_m-7v2khgulr&07_-5j#=sf3' -# SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +SECRET_KEY = config('SECRET_KEY') +DEBUG = config('DEBUG', default=False, cast=bool) -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ['confidencechronogram.herokuapp.com', '127.0.0.1', 'localhost'] # Application definition @@ -74,12 +77,10 @@ # Database # https://docs.djangoproject.com/en/3.0/ref/settings/#databases -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), +default_dburl = 'sqlite:///' + os.path.join(BASE_DIR, 'db.sqlite3') + +DATABASES = { 'default': config('DATABASE_URL', default=default_dburl, cast=dburl), } -} # Password validation @@ -119,3 +120,10 @@ # https://docs.djangoproject.com/en/3.0/howto/static-files/ STATIC_URL = '/static/' +STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') + +import django_heroku + + +# Activate Django-Heroku. +django_heroku.settings(locals()) \ No newline at end of file diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..0f4ca0f --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,34 @@ +asgiref==3.2.3 +astroid==2.3.3 +dj-database-url==0.5.0 +Django==3.0.2 +dodgy==0.2.1 +entrypoints==0.3 +flake8==3.7.9 +isort==4.3.21 +lazy-object-proxy==1.4.3 +mccabe==0.6.1 +mypy==0.770 +mypy-extensions==0.4.3 +pep8-naming==0.4.1 +prospector==1.2.0 +pycodestyle==2.4.0 +pydocstyle==5.0.2 +pyflakes==2.1.1 +pylama==7.7.1 +pylint==2.4.4 +pylint-celery==0.3 +pylint-django==2.0.12 +pylint-flask==0.6 +pylint-plugin-utils==0.6 +python-decouple==3.3 +pytz==2019.3 +PyYAML==5.3 +requirements-detector==0.6 +setoptconf==0.2.0 +six==1.14.0 +snowballstemmer==2.0.0 +sqlparse==0.3.0 +typed-ast==1.4.1 +typing-extensions==3.7.4.1 +wrapt==1.11.2 diff --git a/requirements.txt b/requirements.txt index 5fdd1ad..3416e2f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,29 +1,3 @@ -asgiref==3.2.3 -astroid==2.3.3 -Django==3.0.2 -dodgy==0.2.1 -entrypoints==0.3 -flake8==3.7.9 -isort==4.3.21 -lazy-object-proxy==1.4.3 -mccabe==0.6.1 -pep8-naming==0.4.1 -prospector==1.2.0 -pycodestyle==2.4.0 -pydocstyle==5.0.2 -pyflakes==2.1.1 -pylama==7.7.1 -pylint==2.4.4 -pylint-celery==0.3 -pylint-django==2.0.12 -pylint-flask==0.6 -pylint-plugin-utils==0.6 -pytz==2019.3 -PyYAML==5.3 -requirements-detector==0.6 -setoptconf==0.2.0 -six==1.14.0 -snowballstemmer==2.0.0 -sqlparse==0.3.0 -typed-ast==1.4.1 -wrapt==1.11.2 +-r requirements-dev.txt +gunicorn +psycopg2 diff --git a/runtime.txt b/runtime.txt new file mode 100644 index 0000000..6919bf9 --- /dev/null +++ b/runtime.txt @@ -0,0 +1 @@ +python-3.7.6