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
Copy file name to clipboardExpand all lines: README.md
+75-34Lines changed: 75 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,85 +8,126 @@ A comprehensive membership evaluations solution for Computer Science House.
8
8
Development
9
9
-----------
10
10
11
-
To run the application, you must have the latest version of [Python 3](https://www.python.org/downloads/) and [virtualenv](https://virtualenv.pypa.io/en/stable/installation/) installed. Once you have those installed, create a new virtualenv and install the Python dependencies:
11
+
### Config
12
+
13
+
You must create `config.py` in the top-level directory with the appropriate credentials for the application to run. See `config.env.py` for an example.
12
14
15
+
#### Add OIDC Config
16
+
Reach out to an RTP to get OIDC credentials that will allow you to develop locally behind OIDC auth
You can either develop using the dev database, or use the local database provided in the docker compose file
29
+
30
+
Using the local database is detailed below, but both options will require the dev database password, so you will have to ask an RTP for this too
31
+
32
+
#### Forcing evals/rtp or anything else
33
+
All of the role checking is done in `conditional/utils/user_dict.py`, and you can change the various functions to `return True` for debugging
34
+
35
+
### Run (Without Docker)
36
+
37
+
To run the application without using containers, you must have the latest version of [Python 3](https://www.python.org/downloads/) and [virtualenv](https://virtualenv.pypa.io/en/stable/installation/) installed. Once you have those installed, create a new virtualenv and install the Python dependencies:
38
+
39
+
```sh
40
+
virtualenv .venv
41
+
source .venv/bin/activate
16
42
pip install -r requirements.txt
17
-
export FLASK_APP=app.py
18
43
```
19
44
20
-
In addition, you must have Node, NPM, and Gulp CLI installed to properly execute the asset pipeline. If you don't have Node installed, we recommending installing with [NVM](https://github.com/creationix/nvm):
45
+
In addition, you must have Node, NPM, and Weback CLI installed to properly execute the asset pipeline. If you don't have Node installed, we recommending installing with [NVM](https://github.com/creationix/nvm):
21
46
22
-
```
47
+
```sh
23
48
nvm install
24
49
nvm use
25
-
npm install -g gulp
50
+
npm install -g webpack
26
51
```
27
52
28
-
Then, install the pipeline and frontend dependencies:
53
+
Then, install the pipeline and frontend dependencies: (do this in the `frontend` directory)
29
54
30
-
```
55
+
```sh
31
56
npm install
32
57
```
33
58
34
-
### Config
59
+
Once you have all of the dependencies installed, run
35
60
36
-
You must create `config.py` in the top-level directory with the appropriate credentials for the application to run. See `config.sample.py` for an example.
61
+
```sh
62
+
npm webpack
63
+
```
37
64
38
-
#### Add OIDC Config
39
-
Reach out to an RTP to get OIDC credentials that will allow you to develop locally behind OIDC auth
65
+
This will build the frontend assets and put them in the correct place for use with flask
Once you have all of the dependencies installed, simply run:
81
+
It is likely easier to use containers like `podman` or `docker` or the corresponding compose file
53
82
54
-
```
55
-
npm start
83
+
With podman, I have been using
84
+
85
+
```sh
86
+
podman compose up --force-recreate --build
56
87
```
57
88
58
-
This will run the asset pipeline, start the Python server, and start BrowserSync. Your default web browser will open automatically. If it doesn't, navigate to `http://127.0.0.1:3000`. Any changes made to the frontend files in `frontend` or the Jinja templates in `conditional/templates` will cause the browser to reload automatically.
89
+
Which can be restarted every time changes are made
59
90
60
91
### Dependencies
61
92
62
93
To add new dependencies, add them to `requirements.in` and then run `pip-compile requirements.in` to produce a new locked `requirements.txt`. Do not edit `requirements.txt` directly as it will be overwritten by future PRs.
63
94
64
-
### Local database
95
+
### Database Stuff
65
96
66
-
You can run the database locally using the docker compose, make sure to upgrade it as explained below
97
+
#### Local database
98
+
99
+
You can run the database locally using the docker compose
67
100
68
101
To populate it with dev data for example, you can use the command
This can be helpful for changing the database schema
75
108
76
-
NOTE: to use flask db commands with a database running in the compose file, you will have to update your url to point to localhost, not conditional-postgres
109
+
To run migration commands in the local database, you can run the commands inside the docker container. Any migrations created will also be in the local repository since migrations are mounted in the docker compose
110
+
```sh
111
+
podman exec conditional flask db upgrade
112
+
```
77
113
78
-
### Database Migrations
114
+
####Database Migrations
79
115
80
116
If the database schema is changed after initializing the database, you must migrate it to the new schema by running:
81
117
82
-
```
118
+
```sh
83
119
flask db upgrade
120
+
# or, to run it inside the container for use with local databases (DO THIS
121
+
podman exec conditional flask db upgrade
84
122
```
85
123
124
+
86
125
At the same time, if you change the database schema, you must generate a new migration by running:
87
126
88
-
```
127
+
```sh
89
128
flask db migrate
129
+
# or, to run it inside the container for use with local databases (DO THIS
130
+
podman exec conditional flask db migrate
90
131
```
91
132
92
133
The new migration script in `migrations/versions` should be verified before being committed, as Alembic may not detect every change you make to the models.
@@ -97,7 +138,7 @@ For more information, refer to the [Flask-Migrate](https://flask-migrate.readthe
97
138
98
139
Conditional includes a utility to facilitate data migrations from the old Evals DB. This isn't necessary to run Conditional. To perform this migration, run the following commands before starting the application:
0 commit comments