Reputation: 338
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')
});
Upvotes: 0
Views: 57
Reputation: 826
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).
Upvotes: 1