Define static directory for Django admin site

This commit is contained in:
Tanner Collin 2020-02-06 09:14:50 +00:00
parent e250af14f7
commit 9e40c5d807

View File

@ -30,11 +30,13 @@ DEBUG_ENV = os.environ.get('DEBUG', False)
DEBUG = DEBUG_ENV or False DEBUG = DEBUG_ENV or False
if DEBUG: print('Debug mode ON') if DEBUG: print('Debug mode ON')
PRODUCTION_HOST = 'spaceport.protospace.ca'
# production hosts # production hosts
ALLOWED_HOSTS = [ ALLOWED_HOSTS = [
'api.spaceport-prod.dns.t0.vc', 'api.' + PRODUCTION_HOST,
'api.spaceport.protospace.ca',
'api.my.protospace.ca',
] ]
if DEBUG: if DEBUG:
@ -160,7 +162,12 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images) # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/ # https://docs.djangoproject.com/en/3.0/howto/static-files/
if DEBUG:
STATIC_URL = '/static/' STATIC_URL = '/static/'
else:
STATIC_URL = 'https://static.{}/'.format(PRODUCTION_HOST)
STATIC_ROOT = os.path.join(BASE_DIR, 'data/static')
DEFAULT_RENDERER_CLASSES = ( DEFAULT_RENDERER_CLASSES = (
'rest_framework.renderers.JSONRenderer', 'rest_framework.renderers.JSONRenderer',