Opened 12 months ago
Last modified 7 months ago
#34976 assigned Cleanup/optimization
startproject and startapp should provide feedback
Reported by: | Thibaud Colas | Owned by: | Salvo Polizzi |
---|---|---|---|
Component: | Core (Management commands) | Version: | dev |
Severity: | Normal | Keywords: | tutorial, command, startproject, startapp |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | yes |
Description (last modified by )
Initially proposed on the Django Forum – Feature request: startproject and startapp should provide feedback, where this received 4 "likes" and 5 comments saying this was a good enhancement.
I’d like to propose adding a success message / feedback when running the startproject and startapp commands. For people who are experienced devs it might be expected that a successful script exists without any output. For beginners, it can be very confusing.
This shows up as an issue for people who go through Django tutorials, as django-admin and startproject are often their first point of contact with the framework after installing Django.
From personal experience with Django Girls in particular, this is causing a common issue where people won’t realise the command has worked so will run it multiple times with different options (for example with or without a destination folder), which leads to at best confusing error messages, at worst multiple projects created within one-another.
Output options
Based on the feedback in the forum, I’d recommend starting with the simplest output of confirming the command worked and restating what happened.
Success one-liner
For example, running:
django-admin startproject mysite
The command would display:
Success! Created mysite at /absolute/path/to/where/startproject/created/mysite
I think adding this to startproject
or startapp
would make for a great PR (or two great PRs).
Files created
If the person taking this on has the skills, it’d be nice to also display a recap of what files were created. This will be relevant for both commands, and no matter what template was in use.
For example, running:
django-admin startproject mysite
We could show:
mysite ├── manage.py └── mysite ├── __init__.py ├── asgi.py ├── settings.py ├── urls.py └── wsgi.py
This could be a separate PR if this proves complex. And if this kind of good-looking line art is too hard to do in Django, we could use simple indentation instead:
mysite/ manage.py mysite/ __init__.py settings.py urls.py asgi.py wsgi.py
Change History (17)
comment:1 by , 12 months ago
Description: | modified (diff) |
---|
comment:2 by , 12 months ago
Summary: | Feature request: startproject and startapp should provide feedback → startproject and startapp should provide feedback |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | New feature → Cleanup/optimization |
comment:3 by , 12 months ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:5 by , 10 months ago
Needs tests: | unset |
---|---|
Owner: | changed from | to
comment:6 by , 10 months ago
Patch needs improvement: | unset |
---|
comment:7 by , 10 months ago
New PR: Refs #34976 -- Provide feedback when startapp and startproject are called #17722 by @salvo-polizzi
comment:8 by , 10 months ago
Patch needs improvement: | set |
---|
comment:9 by , 10 months ago
Patch needs improvement: | unset |
---|
comment:10 by , 10 months ago
Patch needs improvement: | set |
---|
comment:11 by , 10 months ago
Patch needs improvement: | unset |
---|
comment:12 by , 9 months ago
Needs tests: | set |
---|
comment:13 by , 9 months ago
Follow-up PR by @TobeTek with directory structure output: Refs #34976 -- Print directory structure after startapp and startproject #17838
comment:14 by , 8 months ago
Patch needs improvement: | set |
---|
comment:15 by , 8 months ago
Needs tests: | unset |
---|---|
Patch needs improvement: | unset |
comment:16 by , 7 months ago
Patch needs improvement: | set |
---|
comment:17 by , 7 months ago
Note that we need the accessibility team to review the tree structure proposal. It has been raised this may not be accessible for speech and braille users.
Still happy to have a success message, but -1 on adding something that would exclude users. I have added a similar comment in the forum discussion 👍
Assigned ticket to Abhay Vachhani