1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-24 07:19:36 +02:00

static hosting

This commit is contained in:
Sean Morley 2024-07-09 09:58:52 -04:00
parent 7b9023dd07
commit e33654a6b6
5 changed files with 23 additions and 4 deletions

View file

@ -13,6 +13,7 @@ import os
from dotenv import load_dotenv
from datetime import timedelta
from os import getenv
from pathlib import Path
# Load environment variables from .env file
load_dotenv()
@ -61,6 +62,7 @@ INSTALLED_APPS = (
)
MIDDLEWARE = (
'whitenoise.middleware.WhiteNoiseMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
@ -69,6 +71,7 @@ MIDDLEWARE = (
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'allauth.account.middleware.AccountMiddleware',
)
# For backwards compatibility for Django 1.8
@ -117,7 +120,11 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/
BASE_DIR = Path(__file__).resolve().parent.parent
STATIC_ROOT = BASE_DIR / "staticfiles"
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
# STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
@ -151,6 +158,12 @@ REST_AUTH = {
}
STORAGES = {
"staticfiles": {
"BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage",
},
}
AUTH_USER_MODEL = 'users.CustomUser'
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

View file

@ -8,4 +8,5 @@ django-cors-headers==4.4.0
coreapi==2.3.3
python-dotenv
psycopg2-binary
Pillow
Pillow
whitenoise