django-vitevue icon indicating copy to clipboard operation
django-vitevue copied to clipboard

404 error when I refresh page

Open HAFTSTUDIO opened this issue 2 years ago • 3 comments

I've managed to succesfully build and run django, vue app with django-vitevue but now when I try to refresh the page, i get a 404 page not found error?? how can I resolve that?

HAFTSTUDIO avatar Dec 12 '22 10:12 HAFTSTUDIO

Same here too. My url contains '/static/frontend/' between base url and page, something like 'localhost:8000/static/frontend/about'. How about yours? Did I miss something? I look into all the vite config, but could not fix it.

ezjung avatar Mar 08 '23 23:03 ezjung

Sorry @HAFTSTUDIO I did not see the issue before. It looks like it is related to the base param in vite config. In production the compiled js is served from a static directory. I have a full working example in this repo and can explain from this code:

  • First check your compilation destination in the command in package.json: here I compile the files directly to a Django static directory, which will be served in production under the /static/frontend url
  • Then check the base parameter in vite config and set it accordingly: here I set it to /static/frontend but it should be the url of where you placed the compilation result

synw avatar Mar 09 '23 08:03 synw

I am facing the following issue. I am using Windows 11, python 3.10

Could not find platform independent libraries <prefix>
Unknown command: 'viteconf'
Type 'manage.py help' for usage.

hmkamrans avatar Sep 22 '23 04:09 hmkamrans