in doc-architect/doc-architect-core/src/main/java/com/docarchitect/core/scanner/impl/python/DjangoAppScanner.java [158:218]
private void parseSettingsFile(Path settingsFile, ScanContext context,
List<Component> components, Set<String> processedApps) throws IOException {
String content = readFileContent(settingsFile);
Matcher appsMatcher = INSTALLED_APPS_PATTERN.matcher(content);
if (!appsMatcher.find()) {
log.debug("No INSTALLED_APPS found in {}", settingsFile);
return;
}
String appsBlock = appsMatcher.group(1);
Matcher appMatcher = APP_STRING_PATTERN.matcher(appsBlock);
while (appMatcher.find()) {
String appName = appMatcher.group(1);
// Skip if already processed
if (processedApps.contains(appName)) {
continue;
}
// Determine component type and create component
ComponentType componentType = determineComponentType(appName, context);
// Skip built-in Django apps to reduce noise
if (componentType == ComponentType.EXTERNAL && appName.startsWith(DJANGO_PREFIX)) {
log.debug("Skipping built-in Django app: {}", appName);
continue;
}
// Try to find the app directory
String appPath = findAppDirectory(appName, context);
String componentId = IdGenerator.generate("django-app", appName);
String displayName = extractAppDisplayName(appName, context, appPath);
Map<String, String> metadata = new HashMap<>();
metadata.put("appName", appName);
metadata.put("settingsFile", context.rootPath().relativize(settingsFile).toString());
if (appPath != null) {
metadata.put("appDirectory", appPath);
}
Component component = new Component(
componentId,
displayName,
componentType,
"Django app: " + appName,
TECHNOLOGY,
appPath != null ? context.rootPath().resolve(appPath).toString() : null,
metadata
);
components.add(component);
processedApps.add(appName);
log.debug("Found Django app: {} (type={})", appName, componentType);
}
}