Skip to content

Update Makefile for uv and improve user creation logic#368

Merged
C4ptainCrunch merged 2 commits into
DocHub-ULB:mainfrom
mnietona:fix/makefile-commands
Mar 19, 2026
Merged

Update Makefile for uv and improve user creation logic#368
C4ptainCrunch merged 2 commits into
DocHub-ULB:mainfrom
mnietona:fix/makefile-commands

Conversation

@mnietona

Copy link
Copy Markdown
Contributor

Description

This PR fixes the Makefile to ensure the local development environment is correctly initialized. It fixes a major issue where the catalog tree and courses were not being loaded into the database.

Closes #263
Closes #366

Key Changes

1. Catalog Tree Initialization

  • Added the mandatory creation of the root "ULB" category during database setup.
  • Added the load_tree and load_courses commands. The previous Makefile missed these steps, leaving the local catalog empty after initialization.

2. Improved Data Creation logic

  • Users: Updated user creation to use get_or_create with defaults to prevent errors if the user already exists. It also correctly sets is_moderator=True for the primary user.
  • Tags: Simplified the tag creation logic to be cleaner and more readable.

3. Environment & Syntax

  • Switched the Python runner to PY=uv run for compatibility with the current project setup.
  • Added .PHONY to prevent conflicts with local files named init or database.

Manual Testing

  1. Ran make database from a fresh state.
  2. Verified that:
    • The "ULB" root category is created.
    • All courses and the category tree are correctly loaded via load_tree and load_courses.
    • Test users and tags are created without errors.
    • Fake documents are generated and linked to the new courses.

@C4ptainCrunch C4ptainCrunch merged commit 4d47197 into DocHub-ULB:main Mar 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] make database command fails on fresh installation for new contributors Fix makefile

2 participants