[Vuejs]-Vue.js webpack and static images (without vuecli and nodejs dev server)

0๐Ÿ‘

I would suggest using Django Webpack loader, since youโ€™re using django and webpack.

0๐Ÿ‘

By the way, I solved my issue with a simple hack.

I looked in some of my view page source in the browser and noted the path served for other classical django static assets.

It should be something like : /static/<name-of-the-app>/img

And then inserted in my component :

<img class="mr-4" v-if="item.picture_file" v-bind:src="item.picture_file">
<img class="mr-4" v-else src="/static/<name-of-the-app>/img/default-avatar.png">

So no webpack tweaking needed anymore, just using the Django static file serving.

Leave a comment