Add create_mock_data management command & allow running app from host#405
Open
paul-ri wants to merge 19 commits into
Open
Add create_mock_data management command & allow running app from host#405paul-ri wants to merge 19 commits into
create_mock_data management command & allow running app from host#405paul-ri wants to merge 19 commits into
Conversation
Markdown expects `1. ` [0]. [0]: https://www.markdownguide.org/basic-syntax/#ordered-lists
This is an older notation from pre-v2 (2022) [0] [0]: https://www.docker.com/blog/announcing-compose-v2-general-availability/
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.
Copied from their doc [0] [0]: https://docs.astral.sh/uv/guides/integration/docker/#installing-uv
`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.
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.
Author
|
I realised the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
.envfile, I can now run the following:docker compose updocker compose run --rm openrepairplatform uv run manage.py create_mock_datadocker compose exec openrepairplatform bash->rsp69001and 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!