瀏覽代碼

Document properly specifying forked app in "INSTALLED_APPS"

master
Joseph Wayodi 3 年之前
父節點
當前提交
f8e1439bf1
共有 1 個檔案被更改,包括 14 行新增0 行删除
  1. 14
    0
      docs/source/topics/customisation.rst

+ 14
- 0
docs/source/topics/customisation.rst 查看文件

@@ -95,6 +95,20 @@ with that for your own app.
95 95
             'yourappsfolder.dashboard.reports.apps.ReportsDashboardConfig',
96 96
         ]
97 97
 
98
+.. note::
99
+
100
+    It is recommended to use the dotted Python path to the app config class,
101
+    rather than to the app package (e.g. ``yourappsfolder.order.apps.OrderConfig``
102
+    instead of ``yourappsfolder.order``).
103
+
104
+    This is to work around a `problem`_ in the way Django's automatic
105
+    ``AppConfig`` discovery (introduced in version 3.2) scans for ``AppConfig``
106
+    subclasses in an app's ``apps.py`` module (in short, it finds all
107
+    ``AppConfig`` subclasses in the ``apps.py``, including ones imported to be
108
+    subclassed). Specifying the path to the app config class ensures that
109
+    automatic ``AppConfig`` discovery is not used at all.
110
+
111
+.. _`problem`: https://code.djangoproject.com/ticket/33013
98 112
 
99 113
 Start customising!
100 114
 ==================

Loading…
取消
儲存