Answers to When starting a new django project via django-admin.py is there a way to inject my own variables? ( 2 )

  1. 2017-01-01 07:01

    For arbitrary variables, nope.

    The current wording is deceptively specific:

    The template context used is:

    Any option passed to the startproject command (among the command’s supported options)

    ...

    Here is a brief discussion that lead to that doc change and the feature has not been discussed since then as far as I can tell.

  2. 2017-01-01 11:01

    There is no such capability with the django generator.

    What you need is called a 'scaffolding' or 'boilerplate' generator. Usually you enter some configuration parameters (using input, conf files etc depending on the generator) and then the generator configures the new project.

    A django generator that is written in python is pyscaffold.

    A very common and popular web scaffolding generator if you are slightly familiar with node.js is Yeoman which surprisingly offers quite a number of django project generators.

    I have personally developed a generator called django-ana but you can search for others here too.

    Experimenting with this is easy because it is matter of installing each generator and generating a project to see what parameters it asks and what it generates. Then pick the one closest to your interest and even open some relevant issue to ask for sth different. Or you can even play with yeoman yourself anyway.

Leave a reply to - When starting a new django project via django-admin.py is there a way to inject my own variables?

◀ Go back