there are two ways to setup the template folder for django development.
first we can setup the path that Django framework can automatically recognize it..
under the component folder, we have to create the a template folder, then create a folder with name matching the component name.
for example we have a lead component, then the structure of the project should look like as following
in the view.py, we can implement with the code snippet below
second. we can modify the DIRS attribute in TEMPLATES setting section in the settings.json to map to the templates path.
then we only have to create a templates folder under the current component folder. we can add the template html in the template folder.
in the view.py we use the template page directly.
No comments:
Post a Comment