Location of static files is also configurable

This commit is contained in:
Oliver Walters 2019-07-10 23:48:33 +10:00
parent 194c15492f
commit ee223e5649
2 changed files with 9 additions and 6 deletions

View File

@ -53,7 +53,7 @@ if cors_opt:
CORS_ORIGIN_ALLOW_ALL = cors_opt.get('allow_all', False)
if CORS_ORIGIN_ALLOW_ALL:
print("Warning: DEBUG mode is enabled, CORS requests are allowed for any domain")
print("Warning: CORS requests are allowed for any domain!")
else:
CORS_ORIGIN_WHITELIST = cors_opt.get('whitelist', [])
@ -106,7 +106,6 @@ LOGGING = {
},
}
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
@ -158,7 +157,7 @@ DATABASES = {}
if 'database' in CONFIG:
DATABASES['default'] = CONFIG['database']
else:
print("Warning: Database backend not specified - using default")
print("Warning: Database backend not specified - using default (sqlite)")
DATABASES['default'] = {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'inventree_db.sqlite3'),
@ -216,7 +215,7 @@ USE_TZ = True
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
CONFIG.get('static_root', os.path.join(BASE_DIR, 'static')),
]
MEDIA_URL = '/media/'

View File

@ -25,8 +25,8 @@ allowed_hosts:
# Cross Origin Resource Sharing (CORS) settings (see https://github.com/ottoyiu/django-cors-headers)
# Following parameters are
cors:
# CORS_ORIGIN_ALLOW_ALL - If True, the whitelist will not be used and all origins will be accepted. Defaults to False.
allow_all: False
# CORS_ORIGIN_ALLOW_ALL - If True, the whitelist will not be used and all origins will be accepted.
allow_all: True
# CORS_ORIGIN_WHITELIST - A list of origins that are authorized to make cross-site HTTP requests. Defaults to []
# whitelist:
@ -38,5 +38,9 @@ cors:
# This should be changed for a production installation
media_root: './media'
# STATIC_ROOT is the local filesystem location for storing static files
# By default it is stored in a directory named 'static' local to the InvenTree directory
static_root: './static'
# Logging options
log_queries: False