-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add seed data to local build database (#55)
* Setup Docker to run local database and server * Add seed data * Add script to load seed data * Update README with seed data loading instructions and remove automatic seed data loading from entrypoint * Add proper line endings and update docs * Add login credentials for local DB * Change seed docker command to docker compose --------- Co-authored-by: Jonathan Loh <[email protected]>
- Loading branch information
Showing
4 changed files
with
2,340 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.sh text eol=lf |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,9 @@ | |
|
||
Ensure you have Docker installed on your local machine. | ||
|
||
Navigate to the root of the project directory where the `docker-compose.yml` file is located. | ||
### Setup | ||
|
||
Navigate to the root of the `backend` directory where the `docker-compose.yml` file is located. | ||
|
||
Build and run the Docker containers: | ||
|
||
|
@@ -12,6 +14,34 @@ docker-compose up --build | |
|
||
The backend should be running and accessible at `http://localhost:8000` | ||
|
||
> Backend admin page is accessible at http://localhost:8000/administration | ||
> Username: dev | ||
> Password: dev | ||
### Seeding the database | ||
|
||
To load seed data into the database, run the following command: | ||
|
||
``` | ||
docker-compose exec backend python treeckle/manage.py loaddata treeckle/treeckle/fixtures/seed_data.json | ||
``` | ||
|
||
This creates the following user accounts for the frontend: | ||
|
||
**Admin** | ||
|
||
Email: [email protected] | ||
|
||
Password: [email protected] | ||
|
||
**Resident** | ||
|
||
Email: resident#@capt.com | ||
|
||
Password: resident# | ||
|
||
where # is any integer between 1-5, i.e. resident1, resident2, resident3... | ||
|
||
## Using External PostgreSQL Database | ||
|
||
Update the `.env.backend.dev` file with the database credentials. | ||
|
This file contains 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
Oops, something went wrong.