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

changed one title and improved seeding docs #825

Merged
merged 7 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- [Work Methodology](/docs/work-methodology.md)
- [Useful Commands](/docs/useful-commands.md)
- [Technologies used on Samf4 🤖](/docs/technical/Samf4Tech.md)
- [Project Specific Commands](/docs/docker-project-specific-commands.md)
- [Useful Docker aliases](/docs/docker-project-specific-commands.md)

## Installation
Expand Down
20 changes: 10 additions & 10 deletions docs/technical/backend/seed.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

Seed scripts are used to populate the database with dummy data for testing. Seed scripts are located in `root/management/commands/seed_scripts/`.

### Seeding commands
### Seeding locally

To seed the database locally, run this in terminal:
To seed the database **locally**, run this in terminal:

- `python manage.py seed`

Expand All @@ -19,19 +19,19 @@ For instance, to seed events run:
- `python manage.py seed events`

### Seeding in docker

After docker container is running, send command to the container:

<!--
`docker compose exec backend python -m pipenv run python manage.py seed`

I find this very long and messy, so I prefer to have a terminal window inside the docker container all the time:
I find this very long and messy, so I prefer to have a terminal window inside the docker container all the time: -->
After docker container is running:

- Go into docker: `docker exec backend bash`
- Enable pipenv: `pipenv shell`
- Run seed script: `python manage.py seed`
- 1) Open shell in Docker container: `docker compose exec backend bash`
- 2) Enable pipenv: `pipenv shell`
- 3) Run seed script: `python manage.py seed`
emilte marked this conversation as resolved.
Show resolved Hide resolved

### Adding/changing seed scripts
❗️Some Docker versiones might require `docker compose exec backend bash` at step 1
emilte marked this conversation as resolved.
Show resolved Hide resolved

### Adding/changing seed scripts
The seed script `seed.py` does not need to be modified to add new seed scripts.
Instead, add scripts inside the `seed_scripts/` folder. In order for them to be detected, you must include it in the `seed_scripts/__init__.py` file:

Expand Down
Loading