Hello, I want to add Vue.js to my project, but I don’t know about the connection between the two. I want to do;
When I open the localhost:8000/student/expert link, it will show the template I have prepared in Vue.js.
My project path is like this:
Serve in Vue.js frontend
serializers.py
from dataclasses import fields
from rest_framework.serializers import ModelSerializer
from .models import StudentExpert
class StudentExpertSerializer(ModelSerializer):
class Meta:
model = StudentExpert
fields = "__all__"
View.py
class StudentViewSet(ModelViewSet):
template_name = "student/expert.html"
queryset = StudentExpert.objects.all()
serializer_class = StudentExpertSerializer
urls.py
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register('kea', StudentViewSet)
app_name = "urls_student"
urlpatterns = [
path('', include(router.urls))
]
As a result of the preparation I made, I was able to serve my student/expert page in this way.
Then I created a page in Vue.js and successfully completed the crud operations.
Vue.Js Port : http://localhost:5173/
Django Port : http://127.0.0.1:8000/student/kea/
What I want to do now is to serve the file I prepared in vue.js when logging in to the http://127.0.0.1:8000/student/kea/ link address.