Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I download a sample Django template?

I just started working at a place as a front end developer where I need to build Django templates. I never worked with these before, does anyone know where I can download a sample template so I can look through the code structure?

I won't be doing any application development using the Django framework, only taking the variables the developer gives me and incorporating the in the html/css templates I build.

like image 723
Vic Avatar asked May 17 '11 13:05

Vic


People also ask

How do I get templates in Django?

To configure the Django template system, go to the settings.py file and update the DIRS to the path of the templates folder. Generally, the templates folder is created and kept in the sample directory where manage.py lives. This templates folder contains all the templates you will create in different Django Apps.

How do I reuse a Django template?

The most flexible way to reuse template fragments is to define an inclusion_tag. You can pass arguments to your custom tag, process them a bit in Python, then bounce back to a template. Direct inclusion only works for fragments that don't depend on the surrounding context.

Does Django have template?

A Django template is a text document or a Python string marked-up using the Django template language. Some constructs are recognized and interpreted by the template engine. The main ones are variables and tags. A template is rendered with a context.

Where are Django admin templates?

The default templates used by the Django admin are located under the /django/contrib/admin/templates/ directory of your Django installation inside your operating system's or virtual env Python environment (e.g. <virtual_env_directory>/lib/python3. 5/site-packages/django/contrib/admin/templates/ ).


1 Answers

There are lots of Open Source django apps that you could look at for inspiration. One example is Zinnia which is a blogging application - there are dozens of templates in this project, see this directory. There are many other open source django projects on http://github.com and http://bitbucket.org

You should also take a look at the official template documentation, there are lots of snippets there that are very useful.

like image 75
jjwchoy Avatar answered Oct 14 '22 20:10

jjwchoy