Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy sample_index.py to project during updateproject #11510

Merged
merged 2 commits into from
Sep 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions arches/management/commands/updateproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,46 @@ def update_to_v7_6(self):
os.path.join(settings.APP_ROOT, "apps.py"),
)

if os.path.isfile(
os.path.join(settings.APP_ROOT, "search_indexes", "sample_index.py")
):
self.stderr.write(
"Existing sample_index.py detected. Skipping creation of sample_index.py",
)
else:
self.stdout.write(
f"Creating /{settings.APP_NAME}/search_indexes/sample_index.py"
)
src_path = os.path.join(settings.APP_ROOT, "search_indexes")
if not os.path.isdir(src_path):
os.mkdir(src_path)

shutil.copy2(
os.path.join(
settings.ROOT_DIR,
"install",
"arches-templates",
"project_name",
"search_indexes",
"sample_index.py",
),
src_path,
)
self.stdout.write(
f"Creating /{settings.APP_NAME}/search_indexes/__init__.py"
)
shutil.copy2(
os.path.join(
settings.ROOT_DIR,
"install",
"arches-templates",
"project_name",
"search_indexes",
"__init__.py",
),
src_path,
)

if os.path.isfile(
os.path.join(
settings.APP_ROOT, "src", settings.APP_NAME, "declarations.d.ts"
Expand Down