Opened 8 years ago

Closed 8 years ago

Last modified 15 months ago

#28307 closed Cleanup/optimization (wontfix)

Add more stub files in startapp template

Reported by: Mark Owned by: nobody
Component: Core (Management commands) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I find that the standard django app template (the one used by the startapp command) is a little bit "messy" and it seems to me that encourages not-so-clean architectures for the apps.

This is what I suggest:

  • A separate forms.py file (to discourage keeping form classes in views.py file)
  • Separate middleware.py and mixins.py files (for the same reason as above, and to make the third party app architectures more similar to django itself, with less doubts for the developer)
  • A separate urls.py file (this is another file I find always creating myself just after the app creation)
  • Refactor tests.py in a tests module, also to encourage modularity of the testsuite instead of creating a mammoth tests.py file by adding "just one more test case" and avoiding the hassle of refactoring the whole thing after some development

I forked the django project on github and created a branch in my repository, here: https://github.com/mcagl/django/tree/mcagl/better-startapp-template

The branch does not conflict with the master branch

Change History (3)

comment:1 by Tim Graham, 8 years ago

Resolution: wontfix
Status: newclosed

You can raise the idea on the DevelopersMailingList but past discussions (search that mailing list's archives for "startapp" and "startproject") to add files or reorganize has not yielded consensus about it -- that's why there's an option for custom project/app templates. The Django master branch no longer suppots Python 2, so # coding: utf-8 would be obsolete.

comment:2 by Tim Graham, 8 years ago

Summary: Cleaner app templateAdd more stub files in startapp template

comment:3 by Natalia Bidart, 15 months ago

Related to ticket #25943

Note: See TracTickets for help on using tickets.
Back to Top