Skip to content

Add create_mock_data management command & allow running app from host#405

Open
paul-ri wants to merge 19 commits into
AtelierSoude:masterfrom
paul-ri:mock_data
Open

Add create_mock_data management command & allow running app from host#405
paul-ri wants to merge 19 commits into
AtelierSoude:masterfrom
paul-ri:mock_data

Conversation

@paul-ri

@paul-ri paul-ri commented Jun 29, 2026

Copy link
Copy Markdown

Salut!

Thanks for having created this project. I'm part of a "Repair Café" in the UK and I wanted to see how your app worked. I struggled a bit to get started there, so the changes here are what I've done to get to a good start for me.

After populating the .env file, I can now run the following:

  1. docker compose up
  2. docker compose run --rm openrepairplatform uv run manage.py create_mock_data
  3. docker compose exec openrepairplatform bash -> rsp
  4. http://localhost:8005
  5. Search 69001 and get at least one event that I can manage as the admin.

I'm also using the PyCharm IDE and I was struggling to debug the app either from the host or Docker. So there are some changes for running the app from the host.

I was keen to see how to get to the management of the event itself: adding users to the queue of repairs & assigning a repairer. But I couldn't get there ;( . It looks like I should as there's a repair tracking feature. I'd be happy if you could point me to that too.

Happy to drop some commits if you think they're out of scope or wrong. I've tried to justify most of them.

Merci!

paul-ri added 10 commits June 29, 2026 13:09
Docker compose syntax is a bit simpler to handle and will also respect
all other settings of the compose definition file.
I couldn't login to the app otherwise. Some prod settings in the dev
file were a bit confusing to me.
The app would never be migrated, preventing from using it.
`venv/` is usually created with `python -m venv`. `.venv` is created by
`uv` and other tools.
It's been removed since docker compose v2. I can't find a reference to this,
but their "getting started" doc [0] doesn't suggest to define this for
example.

[0]: https://docs.docker.com/compose/gettingstarted/#step-2-define-and-start-your-services
* Prevents assuming the project folder's name
* Prevents issues with local `.venv` folder being mounted, then
  overridden by `uv sync` when starting. This was tampering with the
  hosts' permissions.
paul-ri added 9 commits June 29, 2026 20:14
When running the app from the host, the DB is accessible via localhost.
Defining root paths once allows for easier changes. For example, when
running the app from the host on a different path than `/srv` but from
the current git repository.
`/srv/media` was a path, not a URL
In docker compose, we mount the static folder in `/srv/static` for both
prod and dev. Meaning ASSETS_ROOT points to an existing folder for dev
in a Docker container.

When running the app from the host, such folder doesn't exist.

Note: prod shouldn't mount the local static folder as this overrides
whatever the `collectstatic` command is doing
Now that we handle static folders path for dev, there is no need to
mount it again. The 'dev' app doesn't need STATIC_ROOT as Django handles
static files when DEBUG is True [0]

[0]: https://docs.djangoproject.com/en/6.0/howto/static-files/
This is the first time I use the project and starting from an empty DB
was making it difficult to discover the app.

It took me a long time to realise the issue I had no event was because
the "location" of an event was a needed field for the search to show it
(as well as it being 'published') but the model didn't make this
mandatory nor the factory did create a mock value.
@paul-ri

paul-ri commented Jun 29, 2026

Copy link
Copy Markdown
Author

I realised the docker-compose.prod.yml does not extend the docker-compose.yml file. And I reverted a default settings change. I can't test the prod version easily : /

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.

1 participant