Settings
- class alliance_platform.frontend.settings.AlliancePlatformFrontendSettingsType[source]
The type of the settings for the frontend of the Alliance Platform.
You can set these in your django settings like:
from pathlib import Path from typing import TypedDict from alliance_platform.codegen.settings import AlliancePlatformCodegenSettingsType from alliance_platform.core.settings import AlliancePlatformCoreSettingsType # What you define here depends on your setup PROJECT_DIR = Path(__file___).parent.parent # What you define here depends on which Alliance Platform modules you are using. At minimum, you need to include "CORE". class AlliancePlatformSettings(TypedDict): CORE: AlliancePlatformCoreSettingsType CODEGEN: AlliancePlatformCodegenSettingsType ALLIANCE_PLATFORM: AlliancePlatformSettings = { "CORE": { "PROJECT_DIR": PROJECT_DIR, }, "FRONTEND": { "PRODUCTION_DIR": PROJECT_DIR / "frontend/build", } }
Below are the valid keys for
ALLIANCE_PLATFORM["FRONTEND"]:- BUNDLER: str | BaseBundler[source]
The bundler to use as either a string import path or the class instance itself
- DEBUG_COMPONENT_OUTPUT: bool[source]
If true, the React template tag will include a more readable debug output in the HTML in a comment
- FRONTEND_RESOURCE_REGISTRY: str | FrontendResourceRegistry[source]
The resource registry for the bundler. This is used to add additional resources to the bundler that are not automatically discovered. This can be a string import path to the registry or the registry itself.
- EXTRACT_ASSETS_EXCLUDE_DIRS: tuple[Path | str, Pattern[str]][source]
A list of either
re.Patternor aPath. If a template directory matches any entry it will be excluded fromextract_frontend_resources. If aPathis used it will be checked if the directory starts with that path. Otherwise are.Patternwill exclude a directory if it matches.
- BUNDLER_DISABLE_DEV_CHECK_HTML: bool | None[source]
If set to a truthy value
bundler_dev_checks()will not display any HTML error, the error will only be available in the Django dev console.
- NODE_MODULES_DIR: Path | str[source]
The path to the node_modules directory. This is used by ViteBundler to resolve optimized deps, and
extract_frontend_resourcesto determine when an import comes from node_modules directly. It is used by some codegen post processors to run node scripts (e.g. prettier or eslint). It is not used in production, so the directory does not need to exist in production.
- PRODUCTION_DIR: Path[source]
The directory production assets exists in. This directory should include the Vanilla Extract mappings.
- REACT_PROP_HANDLERS: str | list[type[ComponentProp]][source]
Any custom prop handlers to use for react components. This can be a string import path to a list of prop handlers, or the list directly.
- REACT_RENDER_COMPONENT_FILE: Path | str[source]
File that is used to render React components using the
reacttag. This file should export a function namedrenderComponentand a functioncreateElement(this can just be re-exported from React).
- SSR_GLOBAL_CONTEXT_RESOLVER: str | None[source]
Set to a dotted path to a function that will be called to resolve the global context for SSR. This function should return a dictionary of values to be passed to the SSR renderer under the globalContext key.
- SSR_REQUEST_TIMEOUT: float | int | None[source]
Timeout (seconds) for SSR requests made to the JS SSR server.
- SSR_CANCEL_ON_TIMEOUT: bool | None[source]
If true and an SSR request times out, attempt to cancel the in-flight request on the SSR server.
- SSR_CANCEL_TIMEOUT: float | int | None[source]
Timeout (seconds) for the best-effort SSR cancel request.
- DEV_CODE_FORMAT_LIMIT: int | None[source]
The limit to apply for code format requests in development mode. This is limited to 1mb by default; anything above that will not be formatted. This is only applicable to dev mode where code is formatted to make debugging easier when viewing the source.
- DEV_CODE_FORMAT_TIMEOUT: int | None[source]
This is the timeout to apply for code format requests in development mode. This is limited to 1 seconds by default. The only time you should need to tweak this is if you are attempting to debug issues with a large piece of code; in which case you likely need to increase
DEV_CODE_FORMAT_LIMITas well.
- BUNDLER_CHECK_CASE_SENSITIVE: bool[source]
If true, the bundler will check that asset paths match the filesystem casing. This is useful on case-insensitive filesystems (e.g. macOS) to catch mismatches before deploying to case-sensitive systems (e.g. Linux CI). Disabled by default as it is slow. Recommended to enable in CI.