Django Vue.js integration 🔥 How to integrate Django and Vue | Django casts #7

  Рет қаралды 34,303

Red Eyed Coder Club

Red Eyed Coder Club

Күн бұрын

Пікірлер: 95
@RedEyedCoderClub
@RedEyedCoderClub 4 жыл бұрын
So, my friends, I've made another video about Django and Vue.js integration. But this video is about how to get a production ready code, and this approach doesn't require Django-Webpack-Loader and Webpack-Bundle-Tracker plugins. kzbin.info/www/bejne/aZa3pYmPbMmogM0
@RedEyedCoderClub
@RedEyedCoderClub 3 жыл бұрын
What video should I make next? Any suggestions? *Write me in comments!* Follow me @: Telegram: t.me/red_eyed_coder_club Twitter: twitter.com/CoderEyed Facebook: fb.me/redeyedcoderclub Help the channel grow! Please Like the video, Comment, SHARE & Subscribe!
@ivan_inanych
@ivan_inanych 2 жыл бұрын
Сразу заметил русский акцент, но не придал значения, но потом увидел, что пользователя зовут Олег)) Олежа, благодарю за видео, познавательно!
@RedEyedCoderClub
@RedEyedCoderClub 2 жыл бұрын
Спасибо. Там есть и другое видео без использования дополнительных пакетов вообще.
@novackirr
@novackirr 2 жыл бұрын
@@RedEyedCoderClub хорошая работа, олег
@alexpimentelminga6551
@alexpimentelminga6551 2 жыл бұрын
Could you update the tutorial, using vue + vite + django?, since vue CLI no longer recommends using it and it doesn't work well anymore.
@RedEyedCoderClub
@RedEyedCoderClub 2 жыл бұрын
Thanks for the suggestion, I'll think about it
@muhammadhfashaan7581
@muhammadhfashaan7581 Жыл бұрын
u are the best
@anonymousghost5384
@anonymousghost5384 3 жыл бұрын
Linux and open source editor you are awesome
@RedEyedCoderClub
@RedEyedCoderClub 3 жыл бұрын
Thanks for comment
@tdye
@tdye 4 жыл бұрын
Love your videos! Please keep creating. Are you able to make a video on deploying a Vue + Django project with a fully functional database? Perhaps to Heroku?
@RedEyedCoderClub
@RedEyedCoderClub 4 жыл бұрын
Thank you! I'll make this video, but a bit later.
@MarcoAurelio-sv2tk
@MarcoAurelio-sv2tk 3 жыл бұрын
YOU ARE THE MAN!!! TNX
@RedEyedCoderClub
@RedEyedCoderClub 3 жыл бұрын
Thank you!
@jakubschulz4353
@jakubschulz4353 4 жыл бұрын
Cool! I was looking for this!
@jakubschulz4353
@jakubschulz4353 4 жыл бұрын
...but unfortunately it doesn't work for me. Frontend does not work for me. I found that after changing publicPath to '/', localhost in vue works fine, while in django only the header is still loading. Do you have an idea what this might be? I'm using vue 2, maybe that's the problem?
@RedEyedCoderClub
@RedEyedCoderClub 4 жыл бұрын
What does it mean "does not work"?
@jakubschulz4353
@jakubschulz4353 4 жыл бұрын
@@RedEyedCoderClub in console of vue project I have: "Failed to load resource: net::ERR_ADDRESS_INVALID" and "0.0.0.0:8080/favicon.ico:1 Failed to load resource: net::ERR_ADDRESS_INVALID" errors
@RedEyedCoderClub
@RedEyedCoderClub 4 жыл бұрын
favicon is not a problem as usual. Is the Vue object rendered on the Django's page?
@jakubschulz4353
@jakubschulz4353 4 жыл бұрын
@@RedEyedCoderClub as I wrote, only the header is loaded
@saxon5115
@saxon5115 2 жыл бұрын
Will this work to add django to a current project that I have in vue?
@RedEyedCoderClub
@RedEyedCoderClub 2 жыл бұрын
It should work. Consider watching also this video about Django and Vue integration: kzbin.info/www/bejne/aZa3pYmPbMmogM0 It's a different approach to do it.
@nhanNguyen-wo8fy
@nhanNguyen-wo8fy 2 жыл бұрын
---- ---- 1:20 django app ---- 4:30 create new views vuejs app ----- 6:00 install additional package
@RedEyedCoderClub
@RedEyedCoderClub 2 жыл бұрын
Thanks
@chillichilli5231
@chillichilli5231 2 жыл бұрын
Hi, sadly I couldn't make it work. For example: config.devServer didn't allow "hotOnly" or "public" Could you share the version numbers of all necessary js/py libraries?
@RedEyedCoderClub
@RedEyedCoderClub 2 жыл бұрын
Check your code please, also there is another video about Django and Vue integration with a different approach
@jpongthep
@jpongthep 2 жыл бұрын
@@RedEyedCoderClub I get same error. My vue.config.js already contain the existing code as follow. const { defineConfig } = require('@vue/cli-service') module.exports = defineConfig({ transpileDependencies: true })
@rishabhprajapati8423
@rishabhprajapati8423 2 жыл бұрын
watchOptions isn't a property of devServer as well
@RedEyedCoderClub
@RedEyedCoderClub 2 жыл бұрын
@@rishabhprajapati8423 Consider watching of my another video about Vue and Django integration: kzbin.info/www/bejne/aZa3pYmPbMmogM0 It's a different approach, but it's a completely working idea. Was tested in another video about Deploy Django on server: kzbin.info/www/bejne/in3LnKCOo9Kaq6s
@zalderac4900
@zalderac4900 2 жыл бұрын
@@rishabhprajapati8423 I made it work with changing it into a dictionary with the same options. Like it was shown in the error message
@subhajitkarmakar558
@subhajitkarmakar558 4 жыл бұрын
I am getting OSError:Error reading F:\worknpractice\django_python_stuffs\project\djangovue\frontend\webpack-stats.json. Are you sure webpack has generated the file and the path is correct?
@RedEyedCoderClub
@RedEyedCoderClub 4 жыл бұрын
Are you sure webpack has generated the file and the path is correct? Check your code please. And especially all paths.
@vkashpoudel8771
@vkashpoudel8771 4 жыл бұрын
@@RedEyedCoderClub same problem with me aswell. I did as you tought us but finally i am getting [Exception Type:OSError] please help me for this problem.
@RedEyedCoderClub
@RedEyedCoderClub 4 жыл бұрын
Check your code, please
@shuaibb.a.7962
@shuaibb.a.7962 4 жыл бұрын
You are probably using latest version, downgrade to @0.4 as explained in this video then go back to your frontend and remove directory DIST/
@mrgriboman371
@mrgriboman371 2 жыл бұрын
I'm facing the following issue "Error reading /app/frontend/webpack-stats.json. Are you sure webpack has generated the file and the path is correct?" As far as I can see 'webpack-stats.json' isn't being generated at all (or maybe it is, in some weird place). What can be the problem?
@RedEyedCoderClub
@RedEyedCoderClub 2 жыл бұрын
Check your code please. Also there is another video about Django & Vue.js integration without using of django-webpack-loader. kzbin.info/www/bejne/aZa3pYmPbMmogM0
@heljhumenad
@heljhumenad 2 жыл бұрын
is it need to run both runserver for django and npm run for vue side to run the entire project?
@RedEyedCoderClub
@RedEyedCoderClub 2 жыл бұрын
No, the idea of the video is to show how to use Vue.js as a static frontend for Django.
@Alik2202
@Alik2202 3 жыл бұрын
all done and i'm getting error saying 'expected string or bytes-like object'. Can you pls answer ?
@RedEyedCoderClub
@RedEyedCoderClub 3 жыл бұрын
Please, check your code attentively. Also I think that it's better to use this version of integration: kzbin.info/www/bejne/aZa3pYmPbMmogM0 How to deploy it on server: kzbin.info/www/bejne/in3LnKCOo9Kaq6s
@bishwobhandari5132
@bishwobhandari5132 4 жыл бұрын
when i added a routing in vue js app. The django server is not serving those urls. have you tried yet? how to handle routing in vue js in the django server?
@RedEyedCoderClub
@RedEyedCoderClub 4 жыл бұрын
You have to make a request from Vue to the URLs have been described in urls.py. Routing in Vue is for Vue, not for Django. Django reacts only on requests, that are passed through routers in urls.py files.
@Wurstfinger-rl1zi
@Wurstfinger-rl1zi 3 жыл бұрын
Doesn't work for me. Always getting a blank page no matter how many times I re-do everything... the app.js just cannot be found.
@RedEyedCoderClub
@RedEyedCoderClub 3 жыл бұрын
Check your code again!
@krukru4500
@krukru4500 3 жыл бұрын
"Error during template rendering In template C:\Users\Victory\Desktop\djangovuejs\djangovue\templates\index.html, error at line 9" I have such an error comes out at the end when starting the server, help, what can it be?
@chanjack
@chanjack 3 жыл бұрын
I met the same error. Did you fix it?
@krukru4500
@krukru4500 3 жыл бұрын
@@chanjack as I understood this is a compatibility problem, I reinstalled python and the libraries were installed, plus the libraries need to be installed via cmd, and not via ide cmd
@RedEyedCoderClub
@RedEyedCoderClub 3 жыл бұрын
It's better to use this version: kzbin.info/www/bejne/aZa3pYmPbMmogM0 how to deploy it on a server: kzbin.info/www/bejne/in3LnKCOo9Kaq6s
@felix30ua
@felix30ua 4 жыл бұрын
Олег, спасибо! А если frontend после build, как подключить эти файлы?
@RedEyedCoderClub
@RedEyedCoderClub 4 жыл бұрын
I can't explain it in comments.
@felix30ua
@felix30ua 4 жыл бұрын
@@RedEyedCoderClub можно в видеоролике)
@RedEyedCoderClub
@RedEyedCoderClub 4 жыл бұрын
it'll be the next video.
@RedEyedCoderClub
@RedEyedCoderClub 4 жыл бұрын
@@felix30ua I've made the video about it - kzbin.info/www/bejne/aZa3pYmPbMmogM0
@MedievalChips
@MedievalChips 4 жыл бұрын
Hey, what about vue fetch tried that before?
@RedEyedCoderClub
@RedEyedCoderClub 4 жыл бұрын
Not sure that got your question correctly. Can you elaborate more?
@MedievalChips
@MedievalChips 4 жыл бұрын
@@RedEyedCoderClub Similar to Axios there is a fetch api for VueJs that can make get,post,delete requests. So you can just attach vue library and write request with fetch data over http like we used to do with jQuery
@RedEyedCoderClub
@RedEyedCoderClub 4 жыл бұрын
Of course I know about the fetch() function. And I had written two videos with it: kzbin.info/www/bejne/rnK4gHZqe82VY9E kzbin.info/www/bejne/bXi6fKlmaLSmm80 But this video is about "integration" of Vue to Django, about how to make them work together like a single app.
@MedievalChips
@MedievalChips 4 жыл бұрын
@@RedEyedCoderClub Great, I will check them out. I was just wondering which approach do you think is better the Axios/fetch way or integration with this webpack. I am currently also looking into graphene. Maybe a mix of api, fetch and django views? What do think? P.S. love the videos you are making, exactly what I am interested in. Пока!
@captainmujheri
@captainmujheri 4 жыл бұрын
Hey, can you plz make a video on How deploy this on a server.
@RedEyedCoderClub
@RedEyedCoderClub 4 жыл бұрын
Thanks for your suggestion
@bishwobhandari5132
@bishwobhandari5132 4 жыл бұрын
I was going to ask the same thing. right now my dev server is working. Django is serving the Vue application. but when I build Vue files for production and have Django serve static file, I am having difficult time. it would be nice if you make one for that and deploy in like a Linux server or something.
@RedEyedCoderClub
@RedEyedCoderClub 4 жыл бұрын
it'll be the next video. To be exactly it'll be the video about how to get bundled static files (from npm run build) working with Django project. The result - the production ready Django project.
@captainmujheri
@captainmujheri 4 жыл бұрын
@@RedEyedCoderClub ahh, I am waiting for that, and thanks for your efforts :)
@RedEyedCoderClub
@RedEyedCoderClub 4 жыл бұрын
@@captainmujheri It's done - kzbin.info/www/bejne/aZa3pYmPbMmogM0
@alexi_space
@alexi_space 3 жыл бұрын
After I set my vue.config.js my app is stop working
@RedEyedCoderClub
@RedEyedCoderClub 3 жыл бұрын
What doesn't mean stop working? Also there is another video about Django + Vue integration, that doesn't require to use any Django packages.
@deki90to
@deki90to 3 жыл бұрын
'str' object has no attribute 'joinpath'
@RedEyedCoderClub
@RedEyedCoderClub 3 жыл бұрын
That's right. In Django 3 BASE_DIR is an instance of the Path class, not str. Check your code.
@gmartinsfilho
@gmartinsfilho 3 жыл бұрын
video muito, muito bom
@RedEyedCoderClub
@RedEyedCoderClub 3 жыл бұрын
Thank you!
@billy-cg1qq
@billy-cg1qq 3 жыл бұрын
How do I know that this is the right and the easiest way of doing it? He's a Russian computer scientist.
@RedEyedCoderClub
@RedEyedCoderClub 3 жыл бұрын
the approach has some flaws, but there is another video: kzbin.info/www/bejne/aZa3pYmPbMmogM0
@billy-cg1qq
@billy-cg1qq 3 жыл бұрын
@@RedEyedCoderClub God damn it. I hate web development and all the tools needed to just set up a frontend and a backend. it's not supposed to be that complicated all I need is something to interact with and a place to store my data. It has not to be that complicated.
@RedEyedCoderClub
@RedEyedCoderClub 3 жыл бұрын
There's an opinion that having two apps is the right way to do it. One app is the Django app, and the other - a Vue app. We have to use Django Rest Framework to return JSON objects, and the Vue side requests for them with fetch() or axios.js library. Also we host them separately too. This approach (kzbin.info/www/bejne/aZa3pYmPbMmogM0) is a bit easier. We have no need in DRF, and two apps, we can use Webpack and Vue.js components. As you know - all approaches have their own pros and cons.
@ивансмирнов-г5л
@ивансмирнов-г5л 4 жыл бұрын
are you from Russia...??
@RedEyedCoderClub
@RedEyedCoderClub 3 жыл бұрын
yep
@spicemasterii6775
@spicemasterii6775 3 жыл бұрын
Why not just use NodeJS instead of Django?
@blabla-kk8bl
@blabla-kk8bl 3 жыл бұрын
if you are ready to invent every think yourself then use node. Django has stable libraries whic node has nothing stable like django one. ex. stripe subs., user management ....
@RedEyedCoderClub
@RedEyedCoderClub 3 жыл бұрын
Exactly!
@spicemasterii6775
@spicemasterii6775 3 жыл бұрын
Thank you both! Looks like learning Django is worth the effort.
@НораНора-с8й
@НораНора-с8й Жыл бұрын
Проблема с os
Django and Vue Todo App Tutorial (Django Rest Framework / Vue CLI)
33:36
Every team from the Bracket Buster! Who ya got? 😏
0:53
FailArmy Shorts
Рет қаралды 13 МЛН
Air Sigma Girl #sigma
0:32
Jin and Hattie
Рет қаралды 45 МЛН
8 Rules For Learning to Code in 2025...and should you?
12:59
Travis Media
Рет қаралды 301 М.
Django and htmx Tutorial: Easier Web Development
1:05:52
PyCharm, a JetBrains IDE
Рет қаралды 42 М.
Django and Alpine.js - Introduction to Alpine.js
20:26
BugBytes
Рет қаралды 10 М.
How to use Vue with Django (including Auth) 🔒
19:29
Tom Dekan
Рет қаралды 6 М.
AI Is Making You An Illiterate Programmer
27:22
ThePrimeTime
Рет қаралды 289 М.
Django REST Framework - Build an API from Scratch
40:39
Caleb Curry
Рет қаралды 232 М.
Learn Django in 20 Minutes!!
21:25
Tech With Tim
Рет қаралды 476 М.