0

I want to load HTML file in Js file in django,but i get this error: Not Found: /login.html

there is this file in templates folder!


$(document).ready(function () { $('#load_').load('login.html')

});


1 Answer 1

1

You can't just include a file in templates folder an expect it to find in site's directory. Django disallows directory browsing by default. You may define an urlconf to include that html file in your urls such as:

path('login.html/', TemplateView(template_name="login.html"), name='login-html')

But this is discouraged. I think you should use a frontend framework such as React or Vue to load your templates via javascript and use services (which I think the case).

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.