1

Right now I have two apps in the project, here is the project structure: enter image description here

The current function being called is in chess1 and I want to redirect to a url in Chess_Django. My url in Chess_Django/urls.py is path('start/', views.start_game, name='start'). I tried to use window.location.href = "{% url 'Chess_Django:start/' %}". But I got this error: enter image description here

Right now I am able to access it using the absolute path. But I am just curious how to achieve it using Django template language. Thanks!

1 Answer 1

1

try without trailing slash (since it's namespace):

window.location.href = "{% url 'Chess_Django:start' %}"

or even

window.location.href = "{% url 'start' %}"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.