Skip to content
Advertisement

Set iframe url to access pages in navigation bar in Django

I am new to Django framework. I am trying to use html pages in templates and get the interfaces. I got all of the pages one by one. Now I want them appear in an iframe. Here is my html code in homeAdmin.html page.

JavaScript

And here is the views.py code that I have written for this problem.

JavaScript

I am lack of knowledge about what to do next in which file, like in urls.py. Here is the tried code, but it is not working.

JavaScript

All the html files are in the same place. I would be very grateful if anyone could help me with this. Thank you.

Advertisement

Answer

I got a solution from the things I have found so far. In Django framework, they have restricted the iframe options because it might call security threats. So if you want to include iframes, add these parts in settings.py file

JavaScript

And in views.py file, add following codes.

In the beginning:

JavaScript

In the relevant def function:

JavaScript

Now you can see home page with iframes. Thank you.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement