You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`mongodb-org-shell` is already installed; use `mongosh` to interact with MongoDB.
12
+
- The Django project is in `octofit-tracker/backend/octofit_tracker`.
13
+
14
+
# Database Initialization & Population
15
+
1. Ensure the MongoDB service is running.
16
+
2. Configure Django in `settings.py` to connect to the `octofit_db` database using Djongo, with no authentication or password required.
17
+
3. Make sure `octofit_tracker`, `rest_framework`, and `djongo` are in `INSTALLED_APPS`.
18
+
4. Enable CORS in `settings.py` to allow all origins, methods, and headers. Allow all hosts `*`.
19
+
5. Install and configure CORS middleware components.
20
+
6. Run `makemigrations` and `migrate` in the Python virtual environment.
21
+
7. Initialize the `octofit_db` database and create collections for users, teams, activities, leaderboard, and workouts.
22
+
8. Ensure a unique index on the `email` field for the user collection (e.g., `db.users.createIndex({ "email": 1 }, { unique: true })`).
23
+
9. Populate the database with test data for all collections using the Django management command in `octofit-tracker/backend/octofit_tracker/management/commands/populate_db.py`
24
+
a. help message: 'Populate the octofit_db database with test data'.
25
+
b. Django ORM for data deletion and insertion
26
+
c. Make the sample data super heroes and use team marvel and team dc.
27
+
10. Verify the database and collections were created and populated successfully using `mongosh`.
28
+
11. List the collections in the `octofit_db` database and show sample documents from each.
29
+
30
+
# Verification
31
+
- After population, verify with `mongosh` that the `octofit_db` database contains the correct collections and test data.
32
+
- Confirm Django REST API endpoints are available for all collections.
0 commit comments