Icaro Amorim
Icaro Amorim

Reputation: 415

Can I Use One view In a Django Project?

I´m new to web dev, and I was wondering if it´s possible to make a website, that just need to present information of a company (HTML), in just one view.

Like rendering the entire bootstrap in one view.

Upvotes: 0

Views: 65

Answers (2)

ranvir
ranvir

Reputation: 116

I don't know why would you want to do that.

You can use different html files which will be served as your website templates. You can also extend the files using a simple base.html file. This will help you if you want to open other links when people click on different links on the website.

See this example: https://github.com/singh1114/Djangosite/tree/master/duggal/webportal/templates/webportal.

For using this you have to know more about views and urls.

For making scrollable things, you need to know the concept of ids in HTML.

For example

http://yoursite.com/#your_name will try to find id your_name in the HTML. This way you can create scrollable things.

Upvotes: 0

Yannic Hamann
Yannic Hamann

Reputation: 5205

Yes, you can serve your HTML code through a TemplateView.

So if your entire single page application sits in home.html you could definitely do this. But there is no point in using Django for only that purpose. You would rather want to serve your static HTML page from a classic web server like nginx or apache.

Upvotes: 1

Related Questions