Skip to content

Commit

Permalink
hhh
Browse files Browse the repository at this point in the history
  • Loading branch information
muremwa committed Sep 5, 2018
1 parent 7da319d commit e105679
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 10 deletions.
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: gunicorn note.wsgi --log-file -
38 changes: 30 additions & 8 deletions note/settings.py
Original file line number Diff line number Diff line change
@@ -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__)))
Expand All @@ -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 = []

Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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())
1 change: 0 additions & 1 deletion notes/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Pillow==5.1.0
django_heroku
1 change: 1 addition & 0 deletions runtime.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python-3.6.3

0 comments on commit e105679

Please # to comment.