Open AbrarNitk opened 4 years ago
Hi guys, Is there any solution to build the front-end part and only provide service by django server?
I notice the comment at the end of vue.config.js so I try
yarn build
But the server can't get bundle.js and bundle.css
I am not familiar with webpack config. I would appreciate it if you could help me.
Thankfully, I got a solution yesterday.
I add following code in settings.py
MIDDLEWARE = [ ... corsheaders.middleware.CorsMiddleware ... ]
and the CORB problem is solved,
but django server still can't get the resources.
So I add url pattern to get static file in frontend/dist
by django.views.static
,
(related setting way can be found by searching django media)
and finally get the complete Vue page.
Hope this comment can help somebody.
Hi Jordan, Thanks for your help.
I cloned your repository and try to run, It is perfectly working with
npm run serve
with django. Then I build it withnpm run build
and just serving it django so it is not able to loadbundle.js
May you please help in it.I change port in
frontend/vue.config.js
8080 to 8000(django port) Or is it mandatory to runnpm run serve
even in production also.vue.config.js
Then I changed settings.py and change ALLOWED_HOSTS = ["*"], then it is able to get bundle.js but browser is not loading it. Not able to figure out the issue.