gtalarico / django-vue-template

Django Rest + Vue JS Template
https://django-vue-template-demo.herokuapp.com/
MIT License
1.58k stars 406 forks source link

Using history mode for vue-router #22

Closed eliezerp3 closed 5 years ago

eliezerp3 commented 5 years ago

Is there any way to configure django so the vue-router history mode will work. The hash mode in production doesn't look so great.

Love what you have made here and thank you!

eliezerp3 commented 5 years ago

It was as easy as changing the router mode to history. Thought it would clash with django's routes, but it doesn't.

gtalarico commented 5 years ago

Hi thanks for following up.

Django routes still need to be adjusted to use history mode.

You should be able to navigate to / and then to /messages/, but if you reload the page you will get a 404. Django router needs to know Urls endpoints managed by vue router should render index.html and let vue handle the route.

eliezerp3 commented 5 years ago

but if you reload the page you will get a 404

Yep, just noticed this lol.

I added this to the django router but it still goes to the 404 with a "no match found" error. path('/messages', index_view),

gtalarico commented 5 years ago

Missing trailing slash?

eliezerp3 commented 5 years ago

Sorry typo. Put slash on wrong side. Now works fine. Thank you. Just a quick question off topic. Does this api come with a boiler plate authentication system to use (login, signup, cookies / JWT...)

gtalarico commented 5 years ago

👍 No auth in the template, but I would be ok adding if someone sends a PR. Closing this for now since the original issue has been resolved.