Skip to content

Commit

Permalink
Close #2 Setup Heroku app/ Add static directories
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-townsend committed Nov 15, 2022
1 parent 91cb2bd commit 64a6fe1
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions kitchentales/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
TEMPLATES_DIR = os.path.join(BASE_DIR, 'templates')


# Quick-start development settings - unsuitable for production
Expand All @@ -30,7 +31,7 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []
ALLOWED_HOSTS = ['kitchen-tales.herokuapp.com', 'localhost']


# Application definition
Expand All @@ -41,7 +42,9 @@
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'cloudinary_storage',
'django.contrib.staticfiles',
'cloudinary',
'recipes',
]

Expand All @@ -60,7 +63,7 @@
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'DIRS': [TEMPLATES_DIR],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
Expand Down Expand Up @@ -128,6 +131,14 @@
# https://docs.djangoproject.com/en/3.2/howto/static-files/

STATIC_URL = '/static/'
STATICFILES_STORAGE = 'cloudinary_storage.storage.StaticHashedCloudinaryStorage'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

MEDIA_URL = '/media/'
DEFAULT_FILE_STORAGE = 'cloudinary_storage.storage.MediaCloudinaryStorage'



# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
Expand Down

0 comments on commit 64a6fe1

Please sign in to comment.