Generate documents from templates and write them to disk at either
pre-configured locations or in their associated Django app’s static directory
if residing within an app. This command should be run during the deployment
phase and always before collectstatic is run.
This command accepts a list of template names to render. If no names are
specified all templates as specified in STATIC_TEMPLATES will be rendered.
A template name supplied as an argument does not need to be specified in
STATIC_TEMPLATES for it to be found and rendered. Such templates will be
given the global context as specified in STATIC_TEMPLATES.
renderstaticUsage: manage.py renderstatic [OPTIONS] [selectors]...Generate static files from static templates.╭─ Arguments ────────────────────────────────────────────────────────────────────────────╮│selectors<str>Template name selectors for the templates to render. Selectors││are like template names, but can be glob patterns, or patterns││understood by specifically configured loaders. Template ││selectors can resolve to more than one valid template name. ││Default: All template selectors specified in settings. │╰────────────────────────────────────────────────────────────────────────────────────────╯╭─ Options ──────────────────────────────────────────────────────────────────────────────╮│--context-c<str>An alternate context to use when rendering the ││selected templates. This will override any ││conflicting context parameters in the context(s)││specified in settings. Must be a path to any of ││the following file types: python files, json ││files, yaml files, or pickled python ││dictionaries. ││--destination-d<path>The location to render templates to. This will ││override the destination specified in settings ││for selected template, if one exists. If no ││destination is specified in settings or here, ││the default destination is settings.STATIC_ROOT.││--first-engineRender only the set of templates that match the ││selector that are found by the highest priority ││rendering engine. By default (False) any ││templates that match the selector from any ││engine will be rendered. ││--first-loaderRender only the set of templates found by the ││first loader that match any part of the ││selector. By default (False) any template name ││that matches the selector from any loader will ││be rendered. ││--first-preferenceRender only the templates that match the first ││preference for each loader. When combined with ││--first-loader render only the first ││preference(s) of the first loader. Preferences ││are loader specific and documented on the ││loader. For instance, for the App directories ││loader preference is defined as app precedence ││in settings - so if any templates match the ││selector for the highest priority app, only ││those templates would be rendered. ││--exclude-e<path>Exclude these files from rendering, or any files││at or below this directory. ││--no-render-contentsDo not render the contents of the files. If ││paths are templates, destinations will still be ││rendered. ││--helpShow this message and exit.│╰────────────────────────────────────────────────────────────────────────────────────────╯╭─ Django ───────────────────────────────────────────────────────────────────────────────╮│--versionShow program's version number and exit.││--settings<str>The Python path to a settings module, e.g. ││"myproject.settings.main". If this isn't provided, the ││DJANGO_SETTINGS_MODULE environment variable will be used.││--pythonpath<path>A directory to add to the Python path, e.g. ││"/home/djangoprojects/myproject". ││--tracebackRaise on CommandError exceptions││--show-localsPrint local variables in tracebacks.││--no-colorDon't colorize the command output.││--force-colorForce colorization of the command output.││--skip-checksSkip system checks.│╰────────────────────────────────────────────────────────────────────────────────────────╯
renderstaticUsage: manage.py renderstatic [OPTIONS] [selectors]...Generate static files from static templates.╭─ Arguments ────────────────────────────────────────────────────────────────────────────╮│selectors<str>Template name selectors for the templates to render. Selectors││are like template names, but can be glob patterns, or patterns││understood by specifically configured loaders. Template ││selectors can resolve to more than one valid template name. ││Default: All template selectors specified in settings. │╰────────────────────────────────────────────────────────────────────────────────────────╯╭─ Options ──────────────────────────────────────────────────────────────────────────────╮│--context-c<str>An alternate context to use when rendering the ││selected templates. This will override any ││conflicting context parameters in the context(s)││specified in settings. Must be a path to any of ││the following file types: python files, json ││files, yaml files, or pickled python ││dictionaries. ││--destination-d<path>The location to render templates to. This will ││override the destination specified in settings ││for selected template, if one exists. If no ││destination is specified in settings or here, ││the default destination is settings.STATIC_ROOT.││--first-engineRender only the set of templates that match the ││selector that are found by the highest priority ││rendering engine. By default (False) any ││templates that match the selector from any ││engine will be rendered. ││--first-loaderRender only the set of templates found by the ││first loader that match any part of the ││selector. By default (False) any template name ││that matches the selector from any loader will ││be rendered. ││--first-preferenceRender only the templates that match the first ││preference for each loader. When combined with ││--first-loader render only the first ││preference(s) of the first loader. Preferences ││are loader specific and documented on the ││loader. For instance, for the App directories ││loader preference is defined as app precedence ││in settings - so if any templates match the ││selector for the highest priority app, only ││those templates would be rendered. ││--exclude-e<path>Exclude these files from rendering, or any files││at or below this directory. ││--no-render-contentsDo not render the contents of the files. If ││paths are templates, destinations will still be ││rendered. ││--helpShow this message and exit.│╰────────────────────────────────────────────────────────────────────────────────────────╯╭─ Django ───────────────────────────────────────────────────────────────────────────────╮│--versionShow program's version number and exit.││--settings<str>The Python path to a settings module, e.g. ││"myproject.settings.main". If this isn't provided, the ││DJANGO_SETTINGS_MODULE environment variable will be used.││--pythonpath<path>A directory to add to the Python path, e.g. ││"/home/djangoprojects/myproject". ││--tracebackRaise on CommandError exceptions││--show-localsPrint local variables in tracebacks.││--no-colorDon't colorize the command output.││--force-colorForce colorization of the command output.││--skip-checksSkip system checks.│╰────────────────────────────────────────────────────────────────────────────────────────╯
To generate all templates configured in STATIC_TEMPLATES settings:
$manage.pyrenderstatic
Alternatively individual templates can be generated, regardless of their presence in
STATIC_TEMPLATES. They will be given the global context with any overriding context
parameters supplied on the command line: