#24971 closed New feature (fixed)
Make startapp generate an apps.py
| Reported by: | Tim Graham | Owned by: | Mounir |
|---|---|---|---|
| Component: | Core (Management commands) | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
I guess it might look like:
from django.apps import AppConfig
class AppnameConfig(AppConfig):
name = 'appname'
and in __init__.py: default_app_config = 'appname.apps.AppnameConfig'
Change History (10)
comment:1 by , 10 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:2 by , 10 years ago
| Has patch: | set |
|---|---|
| Patch needs improvement: | set |
comment:3 by , 10 years ago
| Patch needs improvement: | unset |
|---|---|
| Triage Stage: | Accepted → Ready for checkin |
comment:5 by , 10 years ago
I just tested this with Django 1.9rc1 and the default_app_config statement was not added to the __init__.py file, the file was blank.
I noticed this first in my own project but also in a blank test project.
Steps
- Created a new Python 3.4 virtualenv
- Installed Django 1.9rc1 via pip
- Ran
django-admin startproject mysite - Ran
python manage.py startapp pollsfrom within the project
Expected Behaviour
- An
apps.pyfile is created with appropriate content - An
__init__.pyfile is created with appropriatedefault_app_configstatement
Actual Behaviour
- An
apps.pyfile is created with appropriate content - An
__init__.pyfile is created but nodefault_app_configstatement is included, the file is blank
comment:7 by , 10 years ago
That said, how about a small enhancement to the 1.9 release notes to clarify the expected behavior?
comment:8 by , 10 years ago
Yeah I think so. Especially if using default_app_config is discouraged, I wasn't aware of this.
I reviewed the PR.