Opened 5 weeks ago

Closed 5 weeks ago

Last modified 5 weeks ago

#36536 closed Bug (duplicate)

Creating nested app using startapp should use full Python path for AppConfig.name

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

Description

Currently when you create a nested app with startapp:

./manage.py startapp example apps/example

The app config will only set ExampleConfg.name = "example" however the correct value should be "apps.example"

I'd recommend this be accepted as a bug with what seems like an easy fix:

  • We should be able to use settings.BASE_DIR (if it wasn't removed) and os.path.relpath() to check if the specified target directory is within the project and convert it to a Python path if so.
  • If for some reason BASE_DIR doesn't exist or the target directory is outside the base dir then we just leave it as the app's name ¯\_(ツ)_/¯

Change History (2)

comment:1 by Sarah Boyce, 5 weeks ago

Resolution: duplicate
Status: newclosed

I believe this is a duplicate of #30618

comment:2 by David Sanders, 5 weeks ago

Ah thanks Sarah… I searched but didn't get that. Glad you're on top of all the tickets ❤️

I might comment on that and ask felix to reconsider because my suggestion is slightly different to the one in that ticket's PR

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