ox.urls
This module provides urls for Oxylus applications.
It scans over applications’ directory for module urls from which it gets:
urls: the list of applications urls to regular views. They will be namespaced under the app label. The final url will look like:{root_url}/{path}.
api_urls: the list of applications urls to API views. They will be namespaced as{app.label}-api. The final url will look like:api/{root_url}/{path}.
urlpatterns: url paths to prepend to project’s urlpatterns. Those are not namespaced.
Where root_url is specified on the AppConfig instance (if none, uses app label). Note that only subclasses of ox.core.apps.AppConfig are taken in account).
Thoses urls will be automatically added to url patterns.
Note
URL are discovered only for Oxylus based application, aka using ox.core.apps.AppConfig.
- class ox.urls.AppUrls(urls, api, urlpatterns)
Bases:
tuple- api
Alias for field number 1
- urlpatterns
Alias for field number 2
- urls
Alias for field number 0
- class ox.urls.Router[source]
Bases:
objectThis class is used to retrieve urls in app’s
urlsmodule, under keysurlsandapi_urls.It will generate three kind of url:
/{url}: forurls’s absolute url (starting with a/);/{app_root_url}/{url}: forurls’s relative url;/api/{app_root_url}/: for url of api views and viewsets (declared usingapi_urls);
- class Discover(module_names=None, oxylus_apps=False, **handlers)[source]
Bases:
DiscoverModules- module_names: str | Iterable[str] = 'urls'
A single or a list of module names to look-up for.
- oxylus_apps: bool = True
Only run over Oxylus applications (subclasses of
ox.core.apps.AppConfig).