Add django-admin startapp template#3358
Conversation
django-admin has a --template flag that lets you specify a directory to base new apps off of. I've added a `startapp_template` directory to the top level directory, updated the post gen hook to remove any files that may not be needed, and updated the documentation for this new process.
|
Please approve this :( |
|
I'm a bit on the edge with this: while it's solving the problem, I find it a bit odd to have an new app template in the repo. After all, the startapp command accepts an URL as template. But maybe having it in the repo means that it can evolve with each person taste... |
# Conflicts: # docs/troubleshooting.rst # hooks/post_gen_project.py
|
I use cookiecutter-django with enough time passing between my generation runs that every single time I find myself struggling with the issue of app creation. Very recently it happened again, and even though you added some extra instructions in the manual to deal with this issue: the thing is that you only added it in the local dev section: https://cookiecutter-django.readthedocs.io/en/latest/2-local-development/developing-locally.html but not in the local dev with docker section: and in my mind at least, these two sections are optional, not sequential (so I only read the docker one, and missed those instructions, and was confused again). So I started to think how I could try to solve this by proposing a PR with some automated post gen hook with the So as an experienced but casual Django developer, I would say this is definitely a pain point that should be addressed in this otherwise excellent and tasty cookiecutter recipe. |
|
There is a discussion about possible changes to django startapp and maybe this is a good place to contribute and maybe make the django app creation API easier to extend django/deps#98 |
Description
django-admin has a --template flag that lets you specify a directory to
base new apps off of. I've added a
startapp_templatedirectory to thetop level directory, updated the post gen hook to remove any files that
may not be needed, and updated the documentation for this new process.
Checklist:
tests/test_cookiecutter_generation.pyis updated accordingly (especially if adding or updating a template option)Rationale
This lets people semi-automatically create new apps without doing a lot of manual file moving and editing.
Fix #1876
Fix #1725
Fix #1505
Fix #881