The current path, api/v1/users, didn’t match any of these

65 views Asked by At

I am experiencing this problem following a tutorial and I can't identify the error in my "SignUpView.vue" page. I tried changing to re_path and it did not work.

Not Found: /api/v1/users  
[15/Oct/2023 22:30:42] `"POST /api/v1/users HTTP/1.1" 404 7646`

Code:

URLS.PY

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path('admin/', admin.site.urls),
    path('api/v1/', include('djoser.urls')),
    path('api/v1/', include('djoser.urls.authtoken'))
]

Error images:

Error showing on signing up

Page not found (404)

SignUpView.vue:

If everything goes right. I'm supposed to get forward on localhost:8080/log-in

methods: {
    submitFrom(e) {
        const formData = {
            username: this.username,
            password: this.password
        }

        axios
            .post("/api/v1/users", formData)
            .then(response => {
                console.log(response)

                this.$router.push('log-in')
            })
1

There are 1 answers

0
willeM_ Van Onsem On BEST ANSWER

The trailing slash is important, and it is advisable to always add one to the URL paths, so you make a POST request on:

.post("/api/v1/users/", formData)  // 🖘 trailing slash