Project SettingsΒΆ

Project settings for template3d operations:
  • STANDARD_TEMPLATE_DIRS = os.path.join(PROJECT_DIR, ‘templates_3d/’)

    The path to your original templates. This will be the new templates directory to work from. All templates in this directory will remain unchanged. Note: keep these with read permissions only for security purposes in public domains.

  • WEB_SERVER_USER=’www-data’

    A user on your system with lowered permissions. This user will assume ownership of the command script and compiled templates. It is recommended to to use the systems web server user. Defaults to www-data if not set.

  • T3D_OPTIMIZE = DEBUG

    This will toggle template optimization for the front-end template3d loading engine. Change this to False if all templates are to remain un-optimized. This is used when all templates are optimized and/or compiled and ready for public use. Setting this also affects command line access. This is a global setting for the current project.

  • T3D_COMPILE = True

    This will toggle template compilation with the Google closure project. Change this to False if all templates are to remain un-compiled. This is used when all templates are optimized and/or compiled and ready for public use. Setting this also affects command line access. This is a global setting for the current project.

  • TEMPLATE_DIRS = (os.path.join(PROJECT_DIR, ‘templates/’)

    This is the normal definition of the template directory. All compiled/optimized templates will be stored here. It is not recommended to store un-compiled templates here (although it is feasible to do so). Any templates here will be used by the django.template.loaders.cached.Loader and stored into memory. Note: Template3d will automatically set the owner of any files here to the WEB_SERVER_USER with write permissions.

Note

When both T3D_OPTIMIZE and `T3D_COMPILE are set to False, no alteration will be allow to the templates. This includes the command line!

Note

Template3d does not support tuples with the TEMPLATE_DIRS setting. If you set it as a tuple, template3d will issue a warning on the command line and ignore all but the first one listed. (See Commands on how to display project warnings.)

Smaller memory usage can be achieved by combining template compilation with the built in django.template.loaders.cached.Loader. The django cached loader will store all templates in TEMPLATE_DIRS into memory. This is why we define a separate templates directory STANDARD_TEMPLATE_DIRS to store un-compiled templates. This can be commented out or enabled like below. The django.template.loaders.cached.Loader takes a list of normal template loaders as options.

To enable template caching

Template caching:

TEMPLATE_LOADERS = (
     (
      'django.template.loaders.cached.Loader', (
              'django.template.loaders.filesystem.Loader',
              'django.template.loaders.app_directories.Loader',
                                               ),
     )
)

Template caching can be disabled as well

Without Template caching:

TEMPLATE_LOADERS = (
              'django.template.loaders.filesystem.Loader',
              'django.template.loaders.app_directories.Loader',
                   )