Skip to content

Commit

Permalink
add devcontainer config files (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
danangmassandy authored Nov 19, 2024
1 parent 184a953 commit 34abb7c
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "Django Docker Environment",
"remoteUser": "vscode",
"postCreateCommand": "git config --global --add safe.directory /home/web/project",
"dockerComposeFile": [
"../deployment/docker-compose.yml",
"../deployment/docker-compose.override.devcontainer.yml"
],
"service": "dev",
"runServices": ["db", "redis", "worker", "dev"],
"workspaceFolder": "/home/web/project",
"runArgs": [
"--env-file",
"../deployment/.env"
],
"portsAttributes": {
"9000": {
"label": "Frontend",
"onAutoForward": "notify"
}
},
"forwardPorts": [8000, 9000],
"shutdownAction": "stopCompose",
"customizations": {
"vscode": {
"extensions": ["ms-python.python", "ms-azuretools.vscode-docker", "njpwerner.autodocstring"],
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"python.pythonPath": "/usr/local/bin/python",
"python.linting.pylintEnabled": true,
"python.linting.enabled": true
}
}
}
}
46 changes: 46 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Chrome",
"request": "launch",
"type": "chrome",
"url": "http://localhost:8000",
"webRoot": "${workspaceFolder}/django_project/frontend",
"sourceMapPathOverrides": {
"webpack:///./src/*": "${webRoot}/*"
}
},
{
"name": "Django: Run server",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/django_project/manage.py",
"args": [
"runserver", "8000"
],
"django": true,
"justMyCode": true,
"env": {
"DJANGO_SETTINGS_MODULE": "core.settings.dev"
}
},
{
"command": "npm run serve",
"name": "React: Run webpack-dev-server",
"request": "launch",
"type": "node-terminal",
"cwd": "${workspaceFolder}/django_project/frontend",
},
],
"compounds": [
{
"name": "Django + React",
"configurations": ["Django: Run server", "React: Run webpack-dev-server"],
"stopAll": true
}
]
}
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"django_project"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
46 changes: 46 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "React: Install dependencies",
"type": "shell",
"command": "npm install --legacy-peer-deps",
"options": {
"cwd": "${workspaceFolder}/django_project/frontend"
},
"group": "build",
"problemMatcher": []
},
{
"label": "React: Webpack-dev-server",
"type": "shell",
"command": "npm run serve",
"port": 9000,
"options": {
"cwd": "${workspaceFolder}/django_project/frontend"
},
"group": "build",
"problemMatcher": []
},
{
"label": "Django: Migrate",
"type": "shell",
"command": "python manage.py migrate",
"group": "build",
"options": {
"cwd": "${workspaceFolder}/django_project"
},
"problemMatcher": []
},
{
"label": "Django: Make Migrations",
"type": "shell",
"command": "python manage.py makemigrations",
"group": "build",
"options": {
"cwd": "${workspaceFolder}/django_project"
},
"problemMatcher": []
},
]
}

0 comments on commit 34abb7c

Please sign in to comment.