From 94549985471f600b38fe98361515f3445b92eefb Mon Sep 17 00:00:00 2001 From: Leandro Roberto Date: Sat, 19 Dec 2020 20:10:23 -0300 Subject: [PATCH] Fix #3327 --- .gitignore | 1 + sapl/settings.py | 15 +++++---------- sapl/webpack-stats.json | 1 - vue.config.js | 16 +++++++--------- 4 files changed, 13 insertions(+), 20 deletions(-) delete mode 100644 sapl/webpack-stats.json diff --git a/.gitignore b/.gitignore index bd56a06d6..0013e9542 100644 --- a/.gitignore +++ b/.gitignore @@ -103,6 +103,7 @@ solr-4.10.2/ postgres-data/ data/ solr-*/ +dev-webpack-stats.json # ignora tudo dentro de media, mas cria a pasta no checkout media/* diff --git a/sapl/settings.py b/sapl/settings.py index 7b722f702..282209ad3 100644 --- a/sapl/settings.py +++ b/sapl/settings.py @@ -107,7 +107,7 @@ INSTALLED_APPS = ( # https://github.com/interlegis/sapl/issues/2055 HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.BaseSignalProcessor' # Disable auto index SEARCH_BACKEND = '' -SEARCH_URL = ['',''] +SEARCH_URL = ['', ''] # SOLR USE_SOLR = config('USE_SOLR', cast=bool, default=False) @@ -178,7 +178,6 @@ CACHES = { } - ROOT_URLCONF = 'sapl.urls' TEMPLATES = [ @@ -242,7 +241,7 @@ EMAIL_RUNNING = None MAX_DOC_UPLOAD_SIZE = 150 * 1024 * 1024 # 150MB MAX_IMAGE_UPLOAD_SIZE = 2 * 1024 * 1024 # 2MB -DATA_UPLOAD_MAX_MEMORY_SIZE= 10 * 1024 * 1024 # 10MB +DATA_UPLOAD_MAX_MEMORY_SIZE = 10 * 1024 * 1024 # 10MB # Internationalization # https://docs.djangoproject.com/en/1.8/topics/i18n/ @@ -270,29 +269,24 @@ LOCALE_PATHS = ( 'locale', ) -FRONTEND_CUSTOM = config('FRONTEND_CUSTOM', default=False, cast=bool) - WEBPACK_LOADER = { 'DEFAULT': { 'CACHE': not DEBUG, 'BUNDLE_DIR_NAME': 'sapl/static/sapl/frontend', - 'STATS_FILE': (BASE_DIR if not FRONTEND_CUSTOM else PROJECT_DIR.child('frontend')).child('webpack-stats.json'), + 'STATS_FILE': PROJECT_DIR.child('frontend').child(f'{"dev-" if DEBUG else ""}webpack-stats.json'), 'POLL_INTERVAL': 0.1, 'TIMEOUT': None, 'IGNORE': [r'.+\.hot-update.js', r'.+\.map'] } } + STATIC_URL = '/static/' STATIC_ROOT = PROJECT_DIR.child("collected_static") STATICFILES_DIRS = ( BASE_DIR.child('static'), ) -if FRONTEND_CUSTOM: - STATICFILES_DIRS = ( - PROJECT_DIR.child('frontend').child('dist'), - ) STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', @@ -369,6 +363,7 @@ def remove_warnings(): message='Unable to import floppyforms.gis' ) + LOGOUT_REDIRECT_URL = '/login' remove_warnings() diff --git a/sapl/webpack-stats.json b/sapl/webpack-stats.json deleted file mode 100644 index 2ecd6d103..000000000 --- a/sapl/webpack-stats.json +++ /dev/null @@ -1 +0,0 @@ -{"status":"done","publicPath":"/static/sapl/frontend/","chunks":{"chunk-vendors":[{"name":"css/chunk-vendors.de0fe4be.css","publicPath":"/static/sapl/frontend/css/chunk-vendors.de0fe4be.css","path":"sapl/static/sapl/frontend/css/chunk-vendors.de0fe4be.css"},{"name":"js/chunk-vendors.46cec023.js","publicPath":"/static/sapl/frontend/js/chunk-vendors.46cec023.js","path":"sapl/static/sapl/frontend/js/chunk-vendors.46cec023.js"},{"name":"css/chunk-vendors.de0fe4be.css.map","publicPath":"/static/sapl/frontend/css/chunk-vendors.de0fe4be.css.map","path":"sapl/static/sapl/frontend/css/chunk-vendors.de0fe4be.css.map"},{"name":"js/chunk-vendors.46cec023.js.map","publicPath":"/static/sapl/frontend/js/chunk-vendors.46cec023.js.map","path":"sapl/static/sapl/frontend/js/chunk-vendors.46cec023.js.map"}],"compilacao":[{"name":"css/compilacao.00eb2b5d.css","publicPath":"/static/sapl/frontend/css/compilacao.00eb2b5d.css","path":"sapl/static/sapl/frontend/css/compilacao.00eb2b5d.css"},{"name":"js/compilacao.44a714dd.js","publicPath":"/static/sapl/frontend/js/compilacao.44a714dd.js","path":"sapl/static/sapl/frontend/js/compilacao.44a714dd.js"},{"name":"css/compilacao.00eb2b5d.css.map","publicPath":"/static/sapl/frontend/css/compilacao.00eb2b5d.css.map","path":"sapl/static/sapl/frontend/css/compilacao.00eb2b5d.css.map"},{"name":"js/compilacao.44a714dd.js.map","publicPath":"/static/sapl/frontend/js/compilacao.44a714dd.js.map","path":"sapl/static/sapl/frontend/js/compilacao.44a714dd.js.map"}],"global":[{"name":"css/global.80b7564c.css","publicPath":"/static/sapl/frontend/css/global.80b7564c.css","path":"sapl/static/sapl/frontend/css/global.80b7564c.css"},{"name":"js/global.bd0aab4d.js","publicPath":"/static/sapl/frontend/js/global.bd0aab4d.js","path":"sapl/static/sapl/frontend/js/global.bd0aab4d.js"},{"name":"css/global.80b7564c.css.map","publicPath":"/static/sapl/frontend/css/global.80b7564c.css.map","path":"sapl/static/sapl/frontend/css/global.80b7564c.css.map"},{"name":"js/global.bd0aab4d.js.map","publicPath":"/static/sapl/frontend/js/global.bd0aab4d.js.map","path":"sapl/static/sapl/frontend/js/global.bd0aab4d.js.map"}],"painel":[{"name":"css/painel.5d957a9b.css","publicPath":"/static/sapl/frontend/css/painel.5d957a9b.css","path":"sapl/static/sapl/frontend/css/painel.5d957a9b.css"},{"name":"js/painel.37936654.js","publicPath":"/static/sapl/frontend/js/painel.37936654.js","path":"sapl/static/sapl/frontend/js/painel.37936654.js"},{"name":"css/painel.5d957a9b.css.map","publicPath":"/static/sapl/frontend/css/painel.5d957a9b.css.map","path":"sapl/static/sapl/frontend/css/painel.5d957a9b.css.map"},{"name":"js/painel.37936654.js.map","publicPath":"/static/sapl/frontend/js/painel.37936654.js.map","path":"sapl/static/sapl/frontend/js/painel.37936654.js.map"}],"parlamentar":[{"name":"css/parlamentar.0e433876.css","publicPath":"/static/sapl/frontend/css/parlamentar.0e433876.css","path":"sapl/static/sapl/frontend/css/parlamentar.0e433876.css"},{"name":"js/parlamentar.84997ad7.js","publicPath":"/static/sapl/frontend/js/parlamentar.84997ad7.js","path":"sapl/static/sapl/frontend/js/parlamentar.84997ad7.js"},{"name":"css/parlamentar.0e433876.css.map","publicPath":"/static/sapl/frontend/css/parlamentar.0e433876.css.map","path":"sapl/static/sapl/frontend/css/parlamentar.0e433876.css.map"},{"name":"js/parlamentar.84997ad7.js.map","publicPath":"/static/sapl/frontend/js/parlamentar.84997ad7.js.map","path":"sapl/static/sapl/frontend/js/parlamentar.84997ad7.js.map"}]}} \ No newline at end of file diff --git a/vue.config.js b/vue.config.js index 7a139a2ce..953ce5a32 100644 --- a/vue.config.js +++ b/vue.config.js @@ -26,14 +26,12 @@ dotenv.config({ path: './sapl/.env' }) -var FRONTEND_CUSTOM = process.env.FRONTEND_CUSTOM === undefined ? false : process.env.FRONTEND_CUSTOM === 'True' - var HOST_NAME = 'localhost' module.exports = { runtimeCompiler: true, publicPath: process.env.NODE_ENV === 'production' ? '/static/sapl/frontend' : `http://${HOST_NAME}:8080/`, - outputDir: FRONTEND_CUSTOM ? 'dist' : './sapl/static/sapl/frontend', + outputDir: './sapl/static/sapl/frontend', chainWebpack: config => { config.plugins.delete('html') @@ -44,21 +42,21 @@ module.exports = { .alias.set('@', path.join(__dirname + "/frontend/", 'src')) config - .plugin('CopyPlugin') - .use(CopyPlugin, [{ - patterns: [ + .plugin('copy') + .use(CopyPlugin, [ + [ { from: path.join(__dirname + "/frontend/", 'public'), to: '.' }, - ], - }]) + ] + ]) config .plugin('RelativeBundleTrackerPlugin') .use(RelativeBundleTrackerPlugin, [{ path: '.', - filename: FRONTEND_CUSTOM ? './webpack-stats.json' : './sapl/webpack-stats.json' + filename: `./frontend/${process.env.DEBUG === 'True' && process.env.NODE_ENV !== 'production' ? 'dev-' : ''}webpack-stats.json` }]) config