Opened 5 years ago
Closed 5 years ago
#30618 closed Bug (wontfix)
AppConfig.name should be a full python path when using the optional directory.
Reported by: | JungChaeMoon | Owned by: | JungChaeMoon |
---|---|---|---|
Component: | Core (Management commands) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | yes | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
Currently, If someone calls the startapp
command with a target directory argument, the generated AppConfig.name
is wrong.
It has to be a python path of app not just name of app.
So, users have to reset the attribute oneself.
In the document, 'AppConfig.name' is defined as follows.
AppConfig.name Full Python path to the application, e.g. 'django.contrib.admin'. This attribute defines which application the configuration applies to. It must be set in all AppConfig subclasses. It must be unique across a Django project.
https://docs.djangoproject.com/en/2.2/ref/applications/#django.apps.AppConfig.name
So, I belive that It has to be a path of app.
Change History (3)
comment:1 by , 5 years ago
Needs tests: | set |
---|---|
Owner: | changed from | to
Summary: | Fix wrong AppConfig.name when called startapp command with target → AppConfig.name should be a full python path when using the optional directory. |
Triage Stage: | Unreviewed → Accepted |
Type: | Cleanup/optimization → Bug |
comment:2 by , 5 years ago
Patch needs improvement: | set |
---|
comment:3 by , 5 years ago
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
I'm sorry, but I realized that we will not be able to handle all cases properly and that this patch can cause regressions for people that call manage.py
for other directories, e.g.
python myproject/manage.py startapp test_app myproject/test_other_name
It is documented that startapp
uses app_name
as passed to the command and I believe that we should keep this behavior. Thanks for your efforts!
PR