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 Mariusz Felisiak, 5 years ago

Needs tests: set
Owner: changed from nobody to JungChaeMoon
Summary: Fix wrong AppConfig.name when called startapp command with targetAppConfig.name should be a full python path when using the optional directory.
Triage Stage: UnreviewedAccepted
Type: Cleanup/optimizationBug

comment:2 by Mariusz Felisiak, 5 years ago

Patch needs improvement: set

comment:3 by Mariusz Felisiak, 5 years ago

Resolution: wontfix
Status: assignedclosed

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!

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