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
+70-22Lines changed: 70 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@
16
16
-[Database](#database)
17
17
-[Backend](#backend)
18
18
-[Frontend](#frontend)
19
+
-[VSCode](#vscode)
19
20
-[Using test users](#using-test-users)
20
21
-[Development Workflow](#development-workflow)
21
22
-[Tech Stack](#tech-stack)
@@ -162,6 +163,11 @@ Website for the students at Industrial Economics and Technology Management at NT
162
163
163
164
## Project Setup
164
165
166
+
[With Docker](#with-docker) below describes how to set up the project fully in Docker. This may not work perfectly for
167
+
everyone, particularly those using Windows - they may instead wish to follow the steps under
168
+
[Without Docker](#without-docker). Finally, [VSCode](#vscode) describes how to configure your development environment in
169
+
the VSCode editor.
170
+
165
171
### With Docker
166
172
167
173
1. Download, install and start Docker Desktop: https://www.docker.com/products/docker-desktop
@@ -248,21 +254,23 @@ If you still want to run Postgres without Docker, download and install it from h
248
254
- If you do not want to use Python 3.9 globally, type `pyenv local 3.9.X` instead (make sure you are in the
249
255
`indok-web` folder when you do this)
250
256
- Type `python --version` to verify that it has been set to `3.9.X`
251
-
5. Type `cd indok-web/backend` to move into the backend folder (or just `cd backend`if you were already in `indok-web`)
257
+
5. Type `cd indok-web` to move into the project folder (if you weren't already there)
252
258
6. Type `python -m venv venv`
253
259
- This sets up a Python virtual environment, to isolate this project from others
254
260
7. Type `source venv/bin/activate` to activate the virtual environment
255
261
- If on Windows, type `.\venv\scripts\activate` instead
256
-
8. Type `python -m pip install -r requirements/local.txt` to install dependencies
262
+
8. Type `cd backend` to move into the `backend` folder
263
+
9. Type `python -m pip install -r requirements/local.txt` to install dependencies
257
264
- If on Windows, also install the GTK3 runtime from the `.exe` here:
258
265
https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer/releases (one of the Python libraries we
259
266
use depends on this)
260
-
9. Ask the project maintainers for dev environment variables (not strictly required, but step 14 will not work without this)
261
-
- If you're a member of Rubberdøk:
262
-
- Go to the `#dev` channel in Slack
263
-
- Find the pinned post with dev environment variables
264
-
- Copy the variables for `backend/.env` into your own `.env` file in `indok-web/backend` (make sure not to overwrite the `DB_HOST` variable from the database setup)
265
-
10. Set the environment variable `DJANGO_READ_DOT_ENV_FILE` to `true`
267
+
10. Ask the project maintainers for dev environment variables (not strictly required, but step 14 will not work without this)
268
+
- If you're a member of Rubberdøk:
269
+
- Go to the `#dev` channel in Slack
270
+
- Find the pinned post with dev environment variables
271
+
- Copy the variables for `backend/.env` into your own `.env` file in `indok-web/backend` (make sure not to
272
+
overwrite the `DB_HOST` variable from the database setup)
273
+
11. Set the environment variable `DJANGO_READ_DOT_ENV_FILE` to `true`
266
274
- On Mac/Linux:
267
275
- Type `code ~/.zshrc` to open the `zsh` config in VSCode
268
276
- If `code` doesn't work, try `open ~/.zshrc` to open it in another text editor
@@ -273,30 +281,33 @@ If you still want to run Postgres without Docker, download and install it from h
273
281
- If `code` doesn't work, type `echo $profile` and open that file in some other text editor
274
282
- Paste this line somewhere in that file: `$env:DJANGO_READ_DOT_ENV_FILE = "true"`
275
283
- Save the file, and re-open PowerShell
276
-
11. Type `python manage.py runserver` to run the backend server
284
+
12. Type `python manage.py runserver` to run the backend server
277
285
- If it fails, make sure that you:
278
286
- are in the `indok-web/backend` folder
279
287
- have your virtual environment active
280
288
- have the database running
281
-
12. Open a new terminal (leave the previous terminal open to keep the server running!)
282
-
- Type `cd indok-web/backend` to get back to the backend folder
283
-
- Type `source venv/bin/activate` (Mac) or `.\venv\scripts\activate` (Windows) to re-activate the virtual environment in this new terminal
284
-
13. Type `python manage.py migrate` to update the database with our backend models
285
-
14. Type `python manage.py loaddata initial_data` to load example data into the database
289
+
13. Open a new terminal (leave the previous terminal open to keep the server running!)
290
+
- Type `cd indok-web` to move into `indok-web` (or `cd ..` if you were put in `indok-web/backend`)
291
+
- Type `source venv/bin/activate` (Mac) or `.\venv\scripts\activate` (Windows) to re-activate the virtual
292
+
environment in this new terminal
293
+
- Type `cd backend` to get back to the backend folder
294
+
14. Type `python manage.py migrate` to update the database with our backend models
295
+
15. Type `python manage.py loaddata initial_data` to load example data into the database
286
296
- This also creates an admin user with username `admin` and password `admin123`
287
297
288
298
Now the backend should be running at `localhost:8000`! You can check out the GraphQL API at `localhost:8000/graphql`, or
289
299
use the Django admin panel at `localhost:8000/admin` (log in with the admin user from step 14).
290
300
291
301
If you want to close the backend, press `Ctrl + C` in the terminal where it runs. To start it again:
292
302
293
-
1. Move into the backend folder (`cd indok-web/backend`)
303
+
1. Move into the `indok-web` folder (`cd indok-web`)
294
304
2. Activate your virtual environment
295
305
- On Mac: `source venv/bin/activate`
296
306
- On Windows: `.\venv\scripts\activate`
297
-
3. Type `python manage.py runserver`
298
-
4. If you need to run migrations:
299
-
- Open a new terminal, and repeat steps 1 and 2
307
+
3. Move into the backend folder (`cd backend`)
308
+
4. Type `python manage.py runserver`
309
+
5. If you need to run migrations:
310
+
- Open a new terminal, and repeat steps 1-3
300
311
- If you've made changes to Django models and want to generate new migrations: `python manage.py makemigrations`
301
312
- Run migrations with `python manage.py migrate`
302
313
@@ -329,6 +340,43 @@ Now the frontend should be running at `localhost:3000`! You can check it out in
329
340
If you want to close the frontend, press `Ctrl + C` in the terminal where it runs. To start it again, type `yarn dev`
330
341
inside `indok-web/frontend` (if dependencies have changed, you may have to run `yarn` first).
331
342
343
+
### VSCode
344
+
345
+
First of all, we recommend installing the following extensions:
0 commit comments