Hello,

The more files get generated to startapp, the more empty useless files accrue 
in many projets, because devs don't take the time to delete those they don't 
use.

Encouraging people to improve the structure of their Django code is worthwhile 
but I don't believe the startapp template is the right medium for that.

Also the best structure will depend a lot on the context. There are many valid 
opinions on what the proper default structure is, depending on each person's 
experience.

For this reason, I'm skeptical of attempts to extend the startapp template. I'm 
more interested in trimming it down.

IIRC we had the discussion quite recently. Perhaps you can find that discussion 
in the archives.


Best regards,

-- 
Aymeric.



> On 14 Jun 2017, at 21:30, [email protected] wrote:
> 
> Hello everyone,
> I'm a Django user for some years now, and I find myself tweaking the app 
> structure after `./manage.py startapp foo`.
> 
> I try to modularize the code and keep things separated. For example I don't 
> like form classes in `views.py`, or very long `tests.py` files (and after 
> also the Django code is organized like this).
> 
> Sometimes, especially when developing an app/project in more than one or two 
> people, some bad habits can kick in, like:
> * I'll just declare this little form class in `views.py`, because a separate 
> file only for this is too much
> * I need another form class, but there is also the previous form class here 
> in `views.py`, no reason to create a `forms.py` file and have some form 
> classes here and some there
> * Now `views.py` is a big file and the effort to refactor can be too 
> overwhelming now, also because we have to ship the code (for murphy-law-esque 
> reasons you'll think that you HAVE to refactor in the worst moment. Hence you 
> WON'T refactor.)
> 
> And the entropy tends to rise and rise.
> 
> The same can go for a single `tests.py` file.
> 
> So I forked django and did a slightly different (cleaner, I think) 
> app_template, and filed a ticket in the bug tracker.
> 
> The ticket: https://code.djangoproject.com/ticket/28307
> The branch on my forked project: 
> https://github.com/mcagl/django/tree/mcagl/better-startapp-template
> 
> It was then that I was directed to raise the question here in the developer's 
> mailing list, so I'm trying to recap the proposals here (and I hope to have 
> done everything correctly):
> 
> * New files: `forms.py`, `middleware.py`, `mixins.py`, `urls.py` to encourage 
> the developer (that can be a newbie) to start with a separation of things 
> that will pay in the long run (and to reinforce the architecture of Django 
> itself in the developer's mind)
> * Refactoring `tests.py` in a `tests` module, also to encourage modularity.
> 
> I was made aware of the `startapp` option to make it use a custom template, 
> but I think that a cleaner template used by default by Django can be a 
> benefit to instill what I think are good habits in the Django developer 
> community.
> 
> What do you think about this proposal?
> 
> Kind regards,
> Mark
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/django-developers 
> <https://groups.google.com/group/django-developers>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-developers/0da65cd4-0496-4ec5-99b5-3d94e887dcb4%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-developers/0da65cd4-0496-4ec5-99b5-3d94e887dcb4%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/F146436F-5F13-40E4-938A-219AE1DD63AF%40polytechnique.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to