diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..d2642c2 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: gunicorn note.wsgi --log-file - \ No newline at end of file diff --git a/note/settings.py b/note/settings.py index 1513c91..bd5b638 100644 --- a/note/settings.py +++ b/note/settings.py @@ -1,4 +1,6 @@ import os +import dj_database_url +import django_heroku # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -8,10 +10,13 @@ # See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'covz8c$cu*@rz51f_533ggd9cs$+kc-0y++ez=xtbh+g#vziyf' +# SECRET_KEY = 'covz8c$cu*@rz51f_533ggd9cs$+kc-0y++ez=xtbh+g#vziyf' +SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', 'covz8c$cu*@rz51f_533ggd9cs$+kc-0y++ez=xtbh+g#vziyf') + # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +# DEBUG = True +DEBUG = bool(os.environ.get('DJANGO_DEBUG', True)) ALLOWED_HOSTS = [] @@ -66,12 +71,12 @@ # Database # https://docs.djangoproject.com/en/2.0/ref/settings/#databases -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), - } -} +# DATABASES = { +# 'default': { +# 'ENGINE': 'django.db.backends.sqlite3', +# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), +# } +# } STATICFILES_DIRS = ( os.path.join(BASE_DIR, "note/static"), @@ -120,3 +125,20 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_URL = '/media/' + + +# Heroku + +db_from_env = dj_database_url.config(conn_max_age=500) + +DATABASES['default'].update(db_from_env) + +PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) + +STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static') + +STATICFILES_DIRS = (os.path.join(PROJECT_ROOT, 'static'),) + +STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage' + +django_heroku.settings(locals()) \ No newline at end of file diff --git a/notes/views.py b/notes/views.py index 829a5b2..937f5b8 100644 --- a/notes/views.py +++ b/notes/views.py @@ -3,7 +3,6 @@ def index(request): if request.user.is_authenticated: - print(request.user.is_authenticated) return render(request, 'notes/index.html') else: print(request.user.is_authenticated) diff --git a/requirements.txt b/requirements.txt index eaecb51..c2dd4ae 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,5 @@ django-markdown-deux==1.0.5 django-pagedown==1.0.5 django-widget-tweaks==1.4.2 markdown2==2.3.5 -Pillow==5.1.0 \ No newline at end of file +Pillow==5.1.0 +django_heroku \ No newline at end of file diff --git a/runtime.txt b/runtime.txt new file mode 100644 index 0000000..be711af --- /dev/null +++ b/runtime.txt @@ -0,0 +1 @@ +python-3.6.3 \ No newline at end of file