Browse Source

Fix #3327

pull/3257/merge
Leandro Roberto 4 years ago
parent
commit
9454998547
  1. 1
      .gitignore
  2. 11
      sapl/settings.py
  3. 1
      sapl/webpack-stats.json
  4. 16
      vue.config.js

1
.gitignore

@ -103,6 +103,7 @@ solr-4.10.2/
postgres-data/ postgres-data/
data/ data/
solr-*/ solr-*/
dev-webpack-stats.json
# ignora tudo dentro de media, mas cria a pasta no checkout # ignora tudo dentro de media, mas cria a pasta no checkout
media/* media/*

11
sapl/settings.py

@ -178,7 +178,6 @@ CACHES = {
} }
ROOT_URLCONF = 'sapl.urls' ROOT_URLCONF = 'sapl.urls'
TEMPLATES = [ TEMPLATES = [
@ -270,29 +269,24 @@ LOCALE_PATHS = (
'locale', 'locale',
) )
FRONTEND_CUSTOM = config('FRONTEND_CUSTOM', default=False, cast=bool)
WEBPACK_LOADER = { WEBPACK_LOADER = {
'DEFAULT': { 'DEFAULT': {
'CACHE': not DEBUG, 'CACHE': not DEBUG,
'BUNDLE_DIR_NAME': 'sapl/static/sapl/frontend', '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, 'POLL_INTERVAL': 0.1,
'TIMEOUT': None, 'TIMEOUT': None,
'IGNORE': [r'.+\.hot-update.js', r'.+\.map'] 'IGNORE': [r'.+\.hot-update.js', r'.+\.map']
} }
} }
STATIC_URL = '/static/' STATIC_URL = '/static/'
STATIC_ROOT = PROJECT_DIR.child("collected_static") STATIC_ROOT = PROJECT_DIR.child("collected_static")
STATICFILES_DIRS = ( STATICFILES_DIRS = (
BASE_DIR.child('static'), BASE_DIR.child('static'),
) )
if FRONTEND_CUSTOM:
STATICFILES_DIRS = (
PROJECT_DIR.child('frontend').child('dist'),
)
STATICFILES_FINDERS = ( STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.FileSystemFinder',
@ -369,6 +363,7 @@ def remove_warnings():
message='Unable to import floppyforms.gis' message='Unable to import floppyforms.gis'
) )
LOGOUT_REDIRECT_URL = '/login' LOGOUT_REDIRECT_URL = '/login'
remove_warnings() remove_warnings()

1
sapl/webpack-stats.json

@ -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"}]}}

16
vue.config.js

@ -26,14 +26,12 @@ dotenv.config({
path: './sapl/.env' path: './sapl/.env'
}) })
var FRONTEND_CUSTOM = process.env.FRONTEND_CUSTOM === undefined ? false : process.env.FRONTEND_CUSTOM === 'True'
var HOST_NAME = 'localhost' var HOST_NAME = 'localhost'
module.exports = { module.exports = {
runtimeCompiler: true, runtimeCompiler: true,
publicPath: process.env.NODE_ENV === 'production' ? '/static/sapl/frontend' : `http://${HOST_NAME}:8080/`, 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 => { chainWebpack: config => {
config.plugins.delete('html') config.plugins.delete('html')
@ -44,21 +42,21 @@ module.exports = {
.alias.set('@', path.join(__dirname + "/frontend/", 'src')) .alias.set('@', path.join(__dirname + "/frontend/", 'src'))
config config
.plugin('CopyPlugin') .plugin('copy')
.use(CopyPlugin, [{ .use(CopyPlugin, [
patterns: [ [
{ {
from: path.join(__dirname + "/frontend/", 'public'), from: path.join(__dirname + "/frontend/", 'public'),
to: '.' to: '.'
}, },
], ]
}]) ])
config config
.plugin('RelativeBundleTrackerPlugin') .plugin('RelativeBundleTrackerPlugin')
.use(RelativeBundleTrackerPlugin, [{ .use(RelativeBundleTrackerPlugin, [{
path: '.', 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 config

Loading…
Cancel
Save