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 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 urls to API views. They will be namespaced as {app.label}-api. The final url will look like: api/{root_url}/{path}.

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.

class ox.urls.AppUrls(urls, api)
api

Alias for field number 1

urls

Alias for field number 0

class ox.urls.Router[source]

This class is used to retrieve urls in app’s urls module, under keys urls and api_urls.

It will generate three kind of url:

  • ``

  • /{url}: for urls’s absolute url (starting with a /);

  • /{app_root_url}/{url}: for urls’s relative url;

  • /api/{app_root_url}/: for url of api views and viewsets (declared using api_urls);

class Discover(module_names=None, **handlers)[source]
module_names: str | Iterable[str] = 'urls'

A single or a list of module names to look-up for.

property apps_urls: dict[AppConfig, tuple][source]

Return urls as a dict of {app: (urls, api_urls)}.

get_app_urls(app, urls)[source]

Return urls for a specific app.

Return type:

list

get_urls()[source]

Generate and return url for all applications.

Return type:

list