MCPcopy Create free account
hub / github.com/vercel/vercel / getDjangoSettings

Function getDjangoSettings

packages/python/src/django.ts:24–45  ·  view source on GitHub ↗
(
  projectDir: string,
  env: NodeJS.ProcessEnv
)

Source from the content-addressed store, hash-verified

22 * then we load that settings module and return all uppercase attributes.
23 */
24export async function getDjangoSettings(
25 projectDir: string,
26 env: NodeJS.ProcessEnv
27): Promise<DjangoSettingsResult> {
28 const { stdout } = await execa('python', ['-c', script], {
29 env,
30 cwd: projectDir,
31 });
32 const parsed = JSON.parse(stdout) as {
33 settings_module: string;
34 django_settings: Record<string, unknown>;
35 django_version?: DjangoVersion;
36 } | null;
37 if (!parsed) {
38 throw new Error('manage.py did not return any settings');
39 }
40 return {
41 settingsModule: parsed.settings_module,
42 djangoSettings: parsed.django_settings,
43 djangoVersion: parsed.django_version ?? null,
44 };
45}
46
47export interface DjangoCollectStaticResult {
48 /** Absolute paths of source static dirs to exclude from the Lambda bundle. */

Callers 1

index.tsFile · 0.90

Calls 2

execaFunction · 0.85
parseMethod · 0.45

Tested by

no test coverage detected