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
* devs may or may not want to reset their local DB
* devs may want to change which DB file is targeted
* devs may want to change which fixture file is loaded
update docs to reflect these changes
[How to provide initial data for models][django-load-initial-data]
10
10
11
11
## Introduction
12
12
13
-
Django [data migrations](https://docs.djangoproject.com/en/4.0/topics/migrations/#data-migrations) are used to load the database with instances of the app's model classes, defined in [`benefits/core/models.py`][core-models].
13
+
The app's model classes are defined in [`benefits/core/models.py`][core-models].
14
14
15
15
Migrations are run as the application starts up. See the [`bin/init.sh`][init] script.
16
16
17
17
The sample values provided in the repository are sufficient to run the app locally and interact with e.g. the sample Transit
18
-
Agencies.
18
+
Agencies.[Django fixtures][django-fixtures] are used to load the database with sample data when running locally.
19
19
20
-
During the [deployment](../deployment/README.md) process, environment-specific values are set in environment variables and are read by the data migration file to build that environment's configuration database. See the [data migration file][data-migration] for the environment variable names.
20
+
During the [deployment](../deployment/README.md) process, some environment-specific values are set in environment variables and
21
+
read dynamically at runtime. Most configuration values are managed directly in the Django Admin interface at the `/admin` endpoint.
21
22
22
23
## Sample data
23
24
@@ -37,32 +38,24 @@ Some configuration data is not available with the samples in the repository:
37
38
- Payment processor configuration for the enrollment phase
38
39
- Amplitude configuration for capturing analytics events
39
40
40
-
### Sample transit agency: `ABC`
41
+
##Rebuilding the configuration database locally
41
42
42
-
- Presents the user a choice between two different eligibility pathways
43
-
- One eligibility verifier requires authentication
44
-
- One eligibility verifier does not require authentication
43
+
A local Django database will be initialized upon first startup of the devcontainer.
45
44
46
-
### Sample transit agency: `DefTL`
47
-
48
-
- Single eligibility pathway, no choice presented to the user
49
-
- Eligibility verifier does not require authentication
50
-
51
-
## Building the configuration database
52
-
53
-
When the data migration changes, the configuration database needs to be rebuilt.
54
-
55
-
The file is called `django.db` and the following commands will rebuild it.
56
-
57
-
Run these commands from within the repository root, inside the devcontainer:
45
+
To rebuild the local Django database, run the [`bin/reset_db.sh`][reset-db] script from within the repository root,
46
+
inside the devcontainer:
58
47
59
48
```bash
60
-
bin/init.sh
49
+
bin/reset_db.sh
61
50
```
62
51
52
+
See the [Django Environment Variables](environment-variables.md#django) section for details about how to configure the local
Copy file name to clipboardexpand all lines: docs/configuration/environment-variables.md
+48-2
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,8 @@
2
2
3
3
The first steps of the Getting Started guide mention [creating an `.env` file][getting-started_create-env].
4
4
5
-
The sections below outline in more detail the application environment variables that you may want to override, and their purpose. In App Service, this is more generally called the ["configuration"][app-service-config].
5
+
The sections below outline in more detail the application environment variables that you may want to override, and their purpose.
6
+
In Azure App Services, this is more generally called the ["configuration"][app-service-config].
6
7
7
8
See other topic pages in this section for more specific environment variable configurations.
8
9
@@ -71,6 +72,39 @@ writable by the Django process._
71
72
72
73
By default, the base project directory (i.e. the root of the repository).
73
74
75
+
### `DJANGO_DB_FILE`
76
+
77
+
!!! info "Local configuration"
78
+
79
+
This setting only affects the app running on localhost
80
+
81
+
The name of the Django database file to use locally (during both normal app startup and for resetting the database).
82
+
83
+
By default, `django.db`.
84
+
85
+
### `DJANGO_DB_FIXTURES`
86
+
87
+
!!! info "Local configuration"
88
+
89
+
This setting only affects the app running on localhost
90
+
91
+
A path, relative to the repository root, of Django data fixtures to load when resetting the database.
92
+
93
+
The file must end in `fixtures.json` for the script to process it correctly.
94
+
95
+
By default, `benefits/core/migrations/local_fixtures.json`.
96
+
97
+
### `DJANGO_DB_RESET`
98
+
99
+
!!! info "Local configuration"
100
+
101
+
This setting only affects the app running on localhost
102
+
103
+
Boolean:
104
+
105
+
-`True` (default): deletes the existing database file and runs fresh Django migrations.
106
+
-`False`: Django uses the existing database file.
107
+
74
108
### `DJANGO_DEBUG`
75
109
76
110
!!! warning "Deployment configuration"
@@ -79,7 +113,7 @@ By default, the base project directory (i.e. the root of the repository).
0 commit comments