Translating Django and Flask

By default, OpenText SAST attempts to discover Django and Jinja2 templates in the project root directory. All detected Django and Jinja2 templates are automatically added to the translation. You can specify additional locations of Django or Jinja2 template files by adding the -django-template-dirs or the -jinja-template-dirs option to the sourceanalyzer command.

If you do not want OpenText SAST to automatically discover Django and Jinja2 templates, use the -disable-template-autodiscover option. If your project requires Django or Jinja2 templates, but the project is configured such that the templates are in an unexpected location, use the -django-template-dirs or -jinja-template-dirs option to specify the directories that contain the templates in addition to the -disable-template-autodiscover option as shown in the following non-Windows examples:

sourceanalyzer -b djangoProj -python-path /usr/lib/python3.12:/usr/local/lib/python3.12/site-packages djangoProj -django-template-dirs djangoProj/templatedir1:/djangoProj/dir2 -disable-template-autodiscover
sourceanalyzer -b flaskProj -python-path /usr/lib/python3.12:/usr/local/lib/python3.12/site-packages flaskProj -jinja-template-dirs flaskProj/templatedir1:/flaskProj/dir2 -disable-template-autodiscover

The following example translates a Python project that has a combination of Django and Jinja2 templates on Windows:

sourceanalyzer -b pythonProj -python-path "C:\Python312\Lib;C:\Python312\Lib\site-packages" flaskProj -django-template-dirs "C:\djangoProj\templatedir1;C:\djangoProj\dir2" -jinja-template-dirs "C:\flaskProj\templatedir1;C:\flaskProj\dir2" -disable-template-autodiscover