Pamela Fox commited on
Commit
dd89092
·
1 Parent(s): c3f151c

Tweaks to dev container

Browse files
.devcontainer/Dockerfile CHANGED
@@ -1,10 +1,6 @@
1
- ARG IMAGE=bullseye
2
  FROM --platform=amd64 mcr.microsoft.com/devcontainers/${IMAGE}
3
 
4
- RUN curl -fsSL https://aka.ms/install-azd.sh | bash
5
-
6
- ENV PYTHONUNBUFFERED 1
7
-
8
  RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
9
  && apt-get -y install --no-install-recommends postgresql-client \
10
  && apt-get update && apt-get install -y xdg-utils \
 
1
+ ARG IMAGE=python:3
2
  FROM --platform=amd64 mcr.microsoft.com/devcontainers/${IMAGE}
3
 
 
 
 
 
4
  RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
5
  && apt-get -y install --no-install-recommends postgresql-client \
6
  && apt-get update && apt-get install -y xdg-utils \
.devcontainer/devcontainer.json CHANGED
@@ -26,6 +26,7 @@
26
  "password": "app_password"
27
  }
28
  ],
 
29
  "python.defaultInterpreterPath": "/usr/local/bin/python",
30
  "python.linting.enabled": true,
31
  "python.testing.pytestEnabled": true,
@@ -40,7 +41,7 @@
40
  "files.exclude": {
41
  "**/*.coverage": true,
42
  ".ruff_cache": true
43
- }
44
  },
45
 
46
  // Add the IDs of extensions you want installed when the container is created.
@@ -51,7 +52,8 @@
51
  "charliermarsh.ruff",
52
  "ms-azuretools.vscode-bicep",
53
  "mtxr.sqltools",
54
- "mtxr.sqltools-driver-pg"
 
55
  ]
56
  }
57
  },
 
26
  "password": "app_password"
27
  }
28
  ],
29
+ "taskExplorer.enabledTasks": {"python": false},
30
  "python.defaultInterpreterPath": "/usr/local/bin/python",
31
  "python.linting.enabled": true,
32
  "python.testing.pytestEnabled": true,
 
41
  "files.exclude": {
42
  "**/*.coverage": true,
43
  ".ruff_cache": true
44
+ }
45
  },
46
 
47
  // Add the IDs of extensions you want installed when the container is created.
 
52
  "charliermarsh.ruff",
53
  "ms-azuretools.vscode-bicep",
54
  "mtxr.sqltools",
55
+ "mtxr.sqltools-driver-pg",
56
+ "spmeesseman.vscode-taskexplorer"
57
  ]
58
  }
59
  },
.devcontainer/docker-compose.yml CHANGED
@@ -8,9 +8,6 @@ services:
8
  args:
9
  # [Choice] Python version: 3, 3.8, 3.7, 3.6
10
  IMAGE: python:3.11
11
- # On Linux, you may need to update USER_UID and USER_GID below if not your local UID is not 1000.
12
- USER_UID: 1000
13
- USER_GID: 1000
14
 
15
  volumes:
16
  - ..:/workspace:cached
 
8
  args:
9
  # [Choice] Python version: 3, 3.8, 3.7, 3.6
10
  IMAGE: python:3.11
 
 
 
11
 
12
  volumes:
13
  - ..:/workspace:cached
.vscode/tasks.json CHANGED
@@ -1,61 +1,52 @@
1
  {
2
  "version": "2.0.0",
3
- "tasks": [{
4
- "label": "Open Django shell",
5
  "type": "shell",
6
- "command": "./src/manage.py shell",
7
  "problemMatcher": [],
8
  "presentation": {
9
  "reveal": "always",
10
- "panel": "new"
11
  }
12
  }, {
13
- "label": "Create super user",
14
  "type": "shell",
15
- "command": "./src/manage.py createsuperuser",
16
  "problemMatcher": [],
17
- "presentation": {
18
- "reveal": "always",
19
- "panel": "new"
20
- }
21
- }, {
22
- "label": "Run Django tests",
23
- "type": "shell",
24
- "command": "./src/manage.py test",
25
- "group": "test",
26
  "presentation": {
27
  "reveal": "always",
28
  "panel": "dedicated"
29
  }
30
  }, {
31
- "label": "Make migrations",
32
  "type": "shell",
33
- "command": "./src/manage.py makemigrations",
34
  "problemMatcher": [],
35
  "presentation": {
36
  "reveal": "always",
37
- "panel": "dedicated"
38
  }
39
  }, {
40
- "label": "Apply migrations",
41
  "type": "shell",
42
- "command": "./src/manage.py migrate",
43
  "problemMatcher": [],
44
  "presentation": {
45
  "reveal": "always",
46
  "panel": "dedicated"
47
  }
48
  }, {
49
- "label": "Load seed data",
50
  "type": "shell",
51
- "command": "./src/manage.py loaddata seed_data.json",
52
  "problemMatcher": [],
53
  "presentation": {
54
  "reveal": "always",
55
- "panel": "dedicated"
56
  }
57
  }, {
58
- "label": "Flush database",
59
  "type": "shell",
60
  "command": "./src/manage.py flush --noinput",
61
  "problemMatcher": [],
@@ -63,5 +54,5 @@
63
  "reveal": "always",
64
  "panel": "dedicated"
65
  }
66
- }]
67
  }
 
1
  {
2
  "version": "2.0.0",
3
+ "tasks": [ {
4
+ "label": "Apply migrations",
5
  "type": "shell",
6
+ "command": "./src/manage.py migrate",
7
  "problemMatcher": [],
8
  "presentation": {
9
  "reveal": "always",
10
+ "panel": "dedicated"
11
  }
12
  }, {
13
+ "label": "Load seed data",
14
  "type": "shell",
15
+ "command": "./src/manage.py loaddata seed_data.json",
16
  "problemMatcher": [],
 
 
 
 
 
 
 
 
 
17
  "presentation": {
18
  "reveal": "always",
19
  "panel": "dedicated"
20
  }
21
  }, {
22
+ "label": "Create super user",
23
  "type": "shell",
24
+ "command": "./src/manage.py createsuperuser",
25
  "problemMatcher": [],
26
  "presentation": {
27
  "reveal": "always",
28
+ "panel": "new"
29
  }
30
  }, {
31
+ "label": "Make migrations",
32
  "type": "shell",
33
+ "command": "./src/manage.py makemigrations",
34
  "problemMatcher": [],
35
  "presentation": {
36
  "reveal": "always",
37
  "panel": "dedicated"
38
  }
39
  }, {
40
+ "label": "Open Django shell",
41
  "type": "shell",
42
+ "command": "./src/manage.py shell",
43
  "problemMatcher": [],
44
  "presentation": {
45
  "reveal": "always",
46
+ "panel": "new"
47
  }
48
  }, {
49
+ "label": "Remove all data from DB (flush)",
50
  "type": "shell",
51
  "command": "./src/manage.py flush --noinput",
52
  "problemMatcher": [],
 
54
  "reveal": "always",
55
  "panel": "dedicated"
56
  }
57
+ }, ]
58
  }
README.md CHANGED
@@ -39,25 +39,19 @@ If you're not using one of those options for opening the project, then you'll ne
39
 
40
  1. Create an `.env` file using `.env.sample` as a guide. Set the value of `DBNAME` to the name of an existing database in your local PostgreSQL instance. Set the values of `DBHOST`, `DBUSER`, and `DBPASS` as appropriate for your local PostgreSQL instance. If you're in the devcontainer, copy the values exactly from `.env.sample`.
41
 
42
- 2. Fill in a secret value for `SECRET_KEY`. You can use this command to generate an appropriate value.
43
-
44
- ```shell
45
- python -c 'import secrets; print(secrets.token_hex())'
46
- ```
47
-
48
- 3. Run the migrations:
49
 
50
  ```
51
  python3 src/manage.py migrate
52
  ```
53
 
54
- 4. Run the local server at port 8000:
55
 
56
  ```
57
  python3 src/manage.py runserver 8000
58
  ```
59
 
60
- 5. Navigate to the displayed URL to verify the website is working.
61
 
62
  ### Admin
63
 
 
39
 
40
  1. Create an `.env` file using `.env.sample` as a guide. Set the value of `DBNAME` to the name of an existing database in your local PostgreSQL instance. Set the values of `DBHOST`, `DBUSER`, and `DBPASS` as appropriate for your local PostgreSQL instance. If you're in the devcontainer, copy the values exactly from `.env.sample`.
41
 
42
+ 2. Run the migrations: (Also available as a VS Code task)
 
 
 
 
 
 
43
 
44
  ```
45
  python3 src/manage.py migrate
46
  ```
47
 
48
+ 3. Run the local server at port 8000: (Also available as a VS Code task)
49
 
50
  ```
51
  python3 src/manage.py runserver 8000
52
  ```
53
 
54
+ 4. Navigate to the displayed URL to verify the website is working.
55
 
56
  ### Admin
57