nuxt: данные не обновляются в Django API в производственном режиме для индекса. vue - PullRequest
0 голосов
/ 26 мая 2020

Я использую nuxt с Django API. В моем index. vue я делаю запрос к серверу для получения данных. Он работает в режиме разработки, но не в продакшене. В процессе производства, когда я изменил значение объекта, изменение не отображается, мне пришлось выполнить «npm run generate», чтобы изменение отобразилось. С другой стороны, это работает, но не на первой странице ...

Есть идеи? Спасибо

nuxt config

let development = process.env.NODE_ENV !== 'production'
let domain = 'my domain'

export default {
  mode: 'universal',
  env: {
    baseUrl: development ? 'http://localhost:8000' : domain
  },
  /*
  ** Headers of the page
  */

  head: {
    title: process.env.npm_package_name || '',
    htmlAttrs: {
        lang: 'fr',
      },
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: process.env.npm_package_description || '' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ]
  },
  /*
  ** Customize the progress-bar color
  */
  loading: { color: '#fff' },
  /*
  ** Global CSS
  */
  css: [
    '~/assets/scss/index.scss',
  ],
  /*
  ** Plugins to load before mounting the App
  */
  plugins: [
    '~/plugins/filters.js',
    '~/plugins/axios.js',
  ],
  /*
  ** Nuxt.js dev-modules
  */
  buildModules: [
],
moment: {
    defaultLocale: 'fr',
    locales: ['fr']
},
/*
** Nuxt.js modules
*/
modules: [
    // Doc: https://bootstrap-vue.js.org
    '@nuxtjs/moment',
    'bootstrap-vue/nuxt',
    '@nuxtjs/axios',
    '@nuxtjs/style-resources',
  ],
  //Resource shared
  styleResources: {
    scss: [
      'bootstrap/scss/_functions.scss',
      'bootstrap/scss/_variables.scss',
      'bootstrap/scss/mixins/_breakpoints.scss',
      './assets/scss/variable/*.scss',
      
  ],
   },
  // deactivate bootstrap-vue for user custom bootstrap
  bootstrapVue: {
    bootstrapCSS: false, 
    bootstrapVueCSS: false
  },
  //proxy backend url enabled
  axios: {
    baseURL:  development ? 'http://localhost:8000' : domain,
    proxy:true,
    credentials: true,
  },
  proxy: {
    '/api/': development ? 'http://localhost:8000' : domain,
    '/media/': development ? 'http://localhost:8000' : domain,
    '/auth/': development ? 'http://localhost:8000' : domain
  },
  module: {
    rules: [
        {
           test: /\.s[ac]ss$/i,
           use: ['style-loader','css-loader','sass-loader',],
         },  
    ],
},
  /*
  ** Build configuration
  */
 build: {
    analyse: true,
    extend (config, {isClient, loaders}) {
        loaders.imgUrl.limit = 10000
    }
 }
}
...