You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/settings.md
+30-5
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,12 @@ source_filename: settings
6
6
To set DRF docs' settings just include the dictionary below in Django's `settings.py` file.
7
7
8
8
REST_FRAMEWORK_DOCS = {
9
-
'HIDE_DOCS': True
9
+
'HIDE_DOCS': True,
10
+
'MODULE_ROUTERS': {
11
+
'project.accounts.urls': 'accounts_router',
12
+
},
13
+
'DEFAULT_MODULE_ROUTER': 'router',
14
+
'DEFAULT_ROUTER': 'project.urls.default_router',
10
15
}
11
16
12
17
@@ -21,9 +26,29 @@ You can use hidden to prevent your docs from showing up in different environment
21
26
22
27
Then set the value of the environment variable `HIDE_DRFDOCS` for each environment (ie. Use `.env` files)
23
28
29
+
##### MODULE_ROUTERS
30
+
Use this setting to manually bind url modules to a router instance. The router must be defined in the module, or imported in the module.
31
+
For instance, if the router of an app called 'gifts' is 'gifts_router', and the router of another app called 'scuba_diving' is 'scuba_diving_router', the MODULE_ROUTERS setting should look like:
32
+
33
+
'MODULE_ROUTERS': {
34
+
'gifts.urls': 'gift_router',
35
+
'scuba_diving.urls': 'scuba_diving_router'
36
+
}
37
+
38
+
If there is no entry for a given module, if this setting is not set, or if it is set to None, the value of the DEFAULT_MODULE_ROUTER setting is used.
39
+
40
+
##### DEFAULT_MODULE_ROUTER
41
+
When set, the value of this setting will be used to find a router for a urls module. If there is no router having the DEFAULT_MODULE_ROUTER name, the setting is ignored and the value of DEFAULT_ROUTER is used.
42
+
43
+
##### DEFAULT_ROUTER
44
+
When defined, this setting must describe a python dotted path leading to the router that should be used when MODULE_ROUTERS and DEFAULT_MODULE_ROUTER are not set.
45
+
This parameter is useful when there is only one router for your whole API.
0 commit comments