Should django-admin allow specifying hidden directories for --template?

129 de afișări
Accesați primul mesaj necitit

laym...@gmail.com

necitită,
1 oct. 2020, 09:16:3301.10.2020
– Django developers (Contributions to Django itself)
Hi everyone,

I've been playing around with the --template option for django-admin startproject lately, and I noticed that it ignores hidden directories (those that start with period) and __pycache__.

I was trying to create a template that includes a GitHub Actions workflow, but I realized that it wasn't in the generated project. The files are stored in the .github/workflows directory, so it's ignored by Django. I don't know if this has been discussed before, but a quick search only led me to this StackOverflow question.

Do you think we should add an option to override this? I can think of some options:
  • Add something like --hidden-dirs to include hidden directories.
  • For files specified using --name, always include them even if they're inside hidden directories, or maybe allow the option to accept directories.
  • Add something like --directory to specify hidden directories explicitly.
I can create a ticket and write a patch for this if you support it. Thanks!

Regards,
Sage

René Fleschenberg

necitită,
1 oct. 2020, 09:47:4801.10.2020
– django-d...@googlegroups.com
Hi,

I can see several use-cases for hidden files / directories in a project
template. Here are some examples from one of my current projects:

.coveragerc
.editorconfig
.flake8
.gitignore
.gitlab-ci.yml
.isort.cfg

Instead of introducing a command line option to explicitly include
things, can we replace the current behavior with a built-in exclusion
list? And maybe an --exclude option to exclude additional things?

Candidates for the exclusion list that come to my mind:

__pycache__
.git
.coverage

Regards,
René

laym...@gmail.com

necitită,
1 oct. 2020, 09:56:5101.10.2020
– Django developers (Contributions to Django itself)
Hi René,

Thanks for the feedback! From my observations, Django does not ignore hidden files,
it only ignores hidden directories. So, the files that you listed should work fine.

As for the built-in exclusion list, I'm not sure if we should add that. I think ignoring .git
by default is fine, but we shouldn't assume that people would like to ignore .coverage.

Regarding exclusion vs inclusion... I'm not sure what the best option is, though! :)

Sage

René Fleschenberg

necitită,
1 oct. 2020, 10:14:5101.10.2020
– django-d...@googlegroups.com
Hi,

On 01.10.20 15:56, laym...@gmail.com wrote:
> Thanks for the feedback! From my observations, Django does not ignore
> hidden /files/,
> it only ignores hidden /directories/. So, the files that you listed
> should work fine.

Ah, my bad, sorry.

> As for the built-in exclusion list, I'm not sure if we should add that.
> I think ignoring .git
> by default is fine, but we shouldn't assume that people would like to
> ignore .coverage.

Hmmm, you mean because other tools besides
https://pypi.org/project/coverage/ might use that path? I guess that
could happen, yup.

> Regarding exclusion vs inclusion... I'm not sure what the best option
> is, though! :)

I think I prefer explicit exclusion by the user (except for obvious
cases like .git and __pycache__) because it's less surprising.

René

laym...@gmail.com

necitită,
1 ian. 2021, 10:07:0401.01.2021
– Django developers (Contributions to Django itself)
Finally got around to create a ticket for this: https://code.djangoproject.com/ticket/32309

I've also created a PoC with a new --directory option: https://github.com/django/django/pull/13827

Sage

Răspundeți tuturor
Răspundeți autorului
Redirecționați
0 mesaje noi