Enable HTMLMin, further Whitenoise config

This commit is contained in:
2021-02-01 02:06:17 +00:00
parent 10f2152d8b
commit d79366d2e6
3 changed files with 14 additions and 12 deletions

View File

@@ -87,12 +87,13 @@ MIDDLEWARE = (
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'htmlmin.middleware.HtmlMinifyMiddleware',
'htmlmin.middleware.MarkRequestMiddleware',
)
ROOT_URLCONF = 'PyRIGS.urls'
WSGI_APPLICATION = 'PyRIGS.wsgi.application'
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
@@ -235,12 +236,14 @@ DATETIME_INPUT_FORMATS = ('%Y-%m-%dT%H:%M', '%Y-%m-%dT%H:%M:%S')
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
STATIC_DIRS = (
os.path.join(BASE_DIR, 'static/')
)
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'pipeline/built_assets/'),
STATIC_DIRS = [
os.path.join(BASE_DIR, 'static/'),
]
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'pipeline/built_assets'),
]
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
WHITENOISE_KEEP_ONLY_HASHED_FILES=True
TEMPLATES = [
{

View File

@@ -61,7 +61,7 @@ function scripts() {
}
function browserSync(done) {
spawn('python', ['manage.py', 'runserver'], {stdio: 'inherit'});
spawn('python', ['manage.py', 'runserver', '--nostatic'], {stdio: 'inherit'});
// TODO Wait for Django server to come up before browsersync, it seems inconsistent
browsersync.init({
notify: true,
@@ -77,9 +77,8 @@ function browserSyncReload(done) {
}
function watchFiles() {
gulp.watch("RIGS/static/scss/**/*.scss", styles);
// TODO This prevents reload looping, but means we don't reload if new third party scripts are added
gulp.watch("RIGS/static/js/src/**/*.js", scripts);
gulp.watch("pipeline/source_assets/scss/**/*.scss", styles);
gulp.watch("pipeline/source_assets/js/**/*.js", scripts);
gulp.watch("**/templates/*.html", browserSyncReload);
}

View File

@@ -3,6 +3,7 @@ asgiref==3.3.1
backports.tempfile==1.0
backports.weakref==1.0.post1
beautifulsoup4==4.9.3
Brotli==1.0.9
cachetools==4.2.1
certifi==2020.12.5
chardet==4.0.0
@@ -18,14 +19,13 @@ django-debug-toolbar==3.2
django-filter==2.4.0
django-gulp==4.1.0
django-ical==1.7.1
django-livereload==1.7
django-livereload-server==0.3.2
django-recaptcha==2.0.6
django-recurrence==1.10.3
django-registration-redux==2.9
django-reversion==3.0.9
django-toolbelt==0.0.1
django-widget-tweaks==1.4.8
django-htmlmin==0.11.0
envparse==0.2.0
gunicorn==20.0.4
icalendar==4.0.7