# Startproject command context

**URL:** <https://forum.djangoproject.com/t/startproject-command-context/24445>\
**Category:** Django Internals\
**Created:** [October 10, 2023, 3:36pm UTC](https://forum.djangoproject.com/t/startproject-command-context/24445 "2023-10-10T15:36:26Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![FJLendinez](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/fjlendinez/32/16361_2.png) [@FJLendinez](https://forum.djangoproject.com/u/FJLendinez)\
**Post date:** [October 10, 2023, 3:36pm UTC](https://forum.djangoproject.com/t/startproject-command-context/24445/1 "2023-10-10T15:36:26Z")

</div>

Hi, all.

I have a suggestion to make here and, if you consider that it can be useful, I can try to develop this feature to contribute in this project.

I face the problem that I can do “python manage.py startproject --template xxx -e py,yml,toml” to create a project based on my template and overwriting the info in py, yml and toml files. That is almost perfect…

Imagine that, I am using docker and I want to overwrite in there the version of python to build. I want to specify the version (or another info, this is just an example) when I create the template. Something like this:

```auto
python manage.py startproject --template xxx -e py,yml,toml -c python_version=3.11 -c using_drf=true ...

```

This makes the templating much more powerful and this can be applied to startapp command too.

Later, if this suggestion go foward, we can discuss if adding context variables to default templates to do something like `startapp -c add_urls=true -c test_as_module=true <name>` could solve some recurring topics

---

<div class="post-metadata">

**Author:** ![FJLendinez](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/fjlendinez/32/16361_2.png) [@FJLendinez](https://forum.djangoproject.com/u/FJLendinez)\
**Post date:** [October 11, 2023, 9:17am UTC](https://forum.djangoproject.com/t/startproject-command-context/24445/2 "2023-10-11T09:17:49Z")

</div>

I read in [this ticket](https://code.djangoproject.com/ticket/20741#comment:4):

> I would probably just make my own command subclassing TemplateCommand and adding the options your templates need

And was closed for that. But it has no sense at all because this command is **to start a new project/app** so, in this case, you can’t subclass this command because you don’t have a project to do this.

---

<div class="post-metadata">

**Author:** ![carltongibson](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/carltongibson/32/267_2.png) [@carltongibson](https://forum.djangoproject.com/u/carltongibson)\
**Post date:** [October 11, 2023, 1:33pm UTC](https://forum.djangoproject.com/t/startproject-command-context/24445/3 "2023-10-11T13:33:18Z")

</div>

Hiya 👋

I **suspect** that this idea would be rejected, in favour of recommending a fully-featured option like cookiecutter.

Super powerful things are possible:

> **[GitHub - cookiecutter/cookiecutter-django: Cookiecutter Django is a framework...](https://github.com/cookiecutter/cookiecutter-django)**
>
> Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly. - GitHub - cookiecutter/cookiecutter-django: Cookiecutter Django is a framework for jumpstarting produc...

Django’s own tool is never going to approach the power of this, and there seems little point adding much complication for an incomplete offering, when the more powerful tool is already there for folks who need it.

---

<div class="post-metadata">

**Author:** ![apollo13](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/apollo13/32/30_2.png) [@apollo13](https://forum.djangoproject.com/u/apollo13)\
**Post date:** [October 11, 2023, 2:18pm UTC](https://forum.djangoproject.com/t/startproject-command-context/24445/4 "2023-10-11T14:18:45Z")

</div>

[Copier](https://copier.readthedocs.io/en/stable/) is another tool that even allows updates of the generated project and manage the whole lifecycle. Maybe we should prominently point people to copier/cookiecutter/yeoman ([Comparisons - copier](https://copier.readthedocs.io/en/stable/comparisons/)) in the docs for the template argument.

---

<div class="post-metadata">

**Author:** ![FJLendinez](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/fjlendinez/32/16361_2.png) [@FJLendinez](https://forum.djangoproject.com/u/FJLendinez)\
**Post date:** [October 11, 2023, 2:36pm UTC](https://forum.djangoproject.com/t/startproject-command-context/24445/5 "2023-10-11T14:36:35Z")

</div>

I agree with you, Cookiecutter is an incredible tool but this is not built-in with django and it “forces” you to do it outside django itself

Another idea/possibility can be the integration of a battle-tested tool like cookiecutter when you use the startproject/startapp CLI. This could bring to django the interactive CLI to create project/apps that it deserves.

As I imagine this, when you use this command it install the dependency of cookiecutter and throw a selector of “django official templates” and, when you select the one you need, the cli starts asking about the variables or configurations required.

---

<div class="post-metadata">

**Author:** ![FJLendinez](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/fjlendinez/32/16361_2.png) [@FJLendinez](https://forum.djangoproject.com/u/FJLendinez)\
**Post date:** [October 11, 2023, 2:42pm UTC](https://forum.djangoproject.com/t/startproject-command-context/24445/6 "2023-10-11T14:42:59Z")

</div>

This integration could end some recurring threads as:

- startapp with urls
- creating (or not) an “apps” folder to encapsulate in a sublevel the django apps to have the main folder appart
- The name of the main folder equal to the project name, some people rename it as main/config/project…
- Use as “microservice” giving the minimal structure to work like [minimal django](https://github.com/rnevius/minimal-django)
- and much more…

---

<div class="post-metadata">

**Author:** ![carltongibson](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/carltongibson/32/267_2.png) [@carltongibson](https://forum.djangoproject.com/u/carltongibson)\
**Post date:** [October 11, 2023, 2:51pm UTC](https://forum.djangoproject.com/t/startproject-command-context/24445/7 "2023-10-11T14:51:05Z")

</div>

I think the reality is that we’re limited in what we have capacity to maintain…

There are a number of project templates out there in the community, but it’s not realistic that we could (even) keep a list updated in the docs, so folks need to rely on searching and the likes of Awesome Django.

I like the idea of suggesting alternative tools to people. (I hadn’t heard of Copier!)

---

<div class="post-metadata">

**Author:** ![FJLendinez](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/fjlendinez/32/16361_2.png) [@FJLendinez](https://forum.djangoproject.com/u/FJLendinez)\
**Post date:** [October 11, 2023, 2:54pm UTC](https://forum.djangoproject.com/t/startproject-command-context/24445/8 "2023-10-11T14:54:48Z")

</div>

In terms of workload I agree with you at all.

The suggestion of alternatives is a good point. @apollo13 was right.
