diff --git a/.gitignore b/.gitignore index ad19f5673b7bf5ee3978731bd408caec6c791bbe..4288bd28607cd47202c4f1e5c1e1b50dab1adf01 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ db.sqlite3 __pycache__ *.pyc /static +env/ \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 059c6e3b2836cfbb887d17688105c04bafa64ebd..de63f73237f011b74f8c8aa3b54e3115918a774c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,5 @@ astroid==2.2.5 Django==2.1.7 selenium==3.141.0 gunicorn==19.9.0 +psycopg2 +dj_database_url \ No newline at end of file diff --git a/superlists/settings.py b/superlists/settings.py index 743a5f7be685f3c0f4e2a93c449124093d0e6e6a..0e628fe31553dd640819dfa9092004a2f1a879ad 100644 --- a/superlists/settings.py +++ b/superlists/settings.py @@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/2.1/ref/settings/ """ import os +import dj_database_url # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -76,13 +77,12 @@ WSGI_APPLICATION = 'superlists.wsgi.application' # Database # https://docs.djangoproject.com/en/2.1/ref/settings/#databases +DATABASE_URL = 'postgres://zrcgjeyohzggpw:7310e5d8c03d5e4ec62247a9bfc04a608bc4ad045c7618ee1a06109be6768a5b@ec2-23-21-160-80.compute-1.amazonaws.com:5432/d2qi0m4m9s14o6' +db_from_env = dj_database_url.config(conn_max_age=600) +DATABASES = {'default': dj_database_url.config(default=DATABASE_URL)} -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), - } -} +# Honor the 'X-Forwarded-Proto' header for request.is_secure() +SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') # Password validation @@ -121,5 +121,9 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.1/howto/static-files/ +STATIC_ROOT = 'staticfiles' STATIC_URL = '/static/' -STATIC_ROOT = os.path.join(BASE_DIR, 'static') + +STATICFILES_DIRS = ( + os.path.join(BASE_DIR, 'static'), +)