Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to serve static web pages from within a Django application?

I am building a relatively simple Django application and apart from the main page where most of the dynamic parts of the application are, there are a few pages that I will need that will not be dynamic at all (About, FAQ, etc.). What is the best way to integrate these into Django, idealing still using the Django template engine? Should I just create a template for each and then have a view that simply renders that template?

like image 372
Paul Wicks Avatar asked Dec 17 '22 10:12

Paul Wicks


2 Answers

Have you looked at flat pages in Django? It probably does everything you're looking for.

like image 192
S.Lott Avatar answered May 13 '23 14:05

S.Lott


If you want to just create a template for each of them, you could use the direct_to_template generic view to serve it up.

Another option would be the django.contrib.flatpages app, which would let you configure the static URLs and content via the database.

like image 34
Jonny Buchanan Avatar answered May 13 '23 15:05

Jonny Buchanan