Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/pip/django-debug-toolbar-4.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pyjavo committed Nov 25, 2023
2 parents 3241cb6 + e627a46 commit e0f53b3
Show file tree
Hide file tree
Showing 42 changed files with 1,016 additions and 17 deletions.
23 changes: 23 additions & 0 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "Django",
"dockerComposeFile": ["local.yml", "docker-compose.extend.yml"],
"service": "workspace",
"shutdownAction": "stopCompose",
"workspaceFolder": "/workspace/",
"forwardPorts": [8000],
"onCreateCommand": "pip install -r requirements/local.txt && pre-commit install",
"postAttachCommand": "python -m pytest",
"remoteEnv": {
"DATABASE_URL": "postgres://${containerEnv:POSTGRES_USER}:${containerEnv:POSTGRES_PASSWORD}@${containerEnv:POSTGRES_HOST}:${containerEnv:POSTGRES_PORT}/${containerEnv:POSTGRES_DB}"
},
"customizations": {
"vscode": {
"settings": {
"python.testing.pytestArgs": ["tests"],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
},
"extensions": ["ms-python.python"]
}
}
}
1 change: 1 addition & 0 deletions .envs/.local/.django
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
# ------------------------------------------------------------------------------
USE_DOCKER=yes
IPYTHONDIR=/app/.ipython
LANG=es_CO.UTF-8
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/pregunta.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Pregunta
about: Si tienes dudas comunicate con nosotros a través de meetup o discord
---

# Preguntas, inquietudes

Puedes escribirnos tus dudas en nuestra página de meetup [pythonbaq](https://www.meetup.com/es-ES/pythonbaq/) o al correo [email protected]

Nos encuentras en el Discord de Python Colombia dentro del [#temii](https://discord.gg/fDsZ6mrdtC).
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/reporte_error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Reporte de error
about: Genera un reporte de error para ayudarnos a mejorar
---

# Error en sitio web de Python Barranquilla

## Comportamiento esperado

En esta zona escribe o adjunta una imagen de como debería funcionar la aplicación web.

## Comportamiento actual

En esta zona escribe o adjunta una imagen de la salida actual que se observa de la aplicación web.
Es preferible el uso de capturas de pantalla además de una descripción paso a paso de como reproducir el error.

## Pasos para reproducir el error

1. En que URL aparece el error.
2. Definir paso a paso las acciones para reproducir el error.
3. En este ejemplo se utiliza una lista numerada.
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/solicitud_mejora.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Solicitud de mejora
about: Encontraste algo que crees que debería tener la app de Temii
---

# Solicitud de mejora en Temii

Especifica como se puede implementar la mejora que sugieres para Temii.

## Ventajas

Que ventajas supone lo que estás sugiriendo a futuro.

## Desventajas

Cuales crees que podrían ser los inconvenientes que pueda ocasionar la implementación de lo que estás sugiriendo a futuro.
7 changes: 7 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Pull request

Closes #(número del issue)

## Observaciones

Escribe o adjunta una imagen de la información que considere pertinente del cambio que se está subiendo. Por ejemplo una captura de pantalla en algún cambio visual.
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"python.testing.pytestArgs": ["tests"],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ Para ejecutar docker compose localmente toca especificarle que use el archivo lo

- Para crear una **cuenta de superadministrador**, usa el comando:

python manage.py createsuperuser
```bash
docker compose -f local.yml run --rm django python manage.py shell_plus

python manage.py createsuperuser
```

Por conveniencia, puedes abrir el usuario normal en un navegador, y el super-administrador en otro y ver los comportamientos para cada tipo de usuario.

Expand All @@ -36,12 +40,24 @@ Puedes correr los checks de tipos de datos con el comando

mypy temii

### Debugging con ipdb

Levanta los contenedores de forma _detached_, detén el de django y luego habilita el puerto donde corre. De la siguiente manera:

```bash
docker compose -f local.yml up -d
docker compose -f local.yml down django
docker compose -f local.yml run --rm --service-ports django
```

De esta forma podrás usar `import ipdb; ipdb.set_trace()` en tu código de Python sin problemas.

### Cobertura de pruebas

Para ejecutar los tests, verificar el coverage y generar un reporte de coverage en HTML:

coverage run -m pytest
coverage html
docker compose -f local.yml run --rm django coverage run -m pytest
docker compose -f local.yml run --rm django coverage html
open htmlcov/index.html

#### Ejecutar los test usando pytest
Expand Down
1 change: 1 addition & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@

LOCAL_APPS = [
"temii.users",
"temii.talks"
# Your stuff: custom apps go here
]
# https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
Expand Down
1 change: 1 addition & 0 deletions config/settings/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,4 @@

# Your stuff...
# ------------------------------------------------------------------------------
CSRF_TRUSTED_ORIGINS = ["https://localhost:8000", "http://localhost:8000"]
1 change: 1 addition & 0 deletions config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
path(settings.ADMIN_URL, admin.site.urls),
# User management
path("users/", include("temii.users.urls", namespace="users")),
path("talks/", include("temii.talks.urls", namespace="talks")),
path("accounts/", include("allauth.urls")),
# Your stuff: custom urls includes go here
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Expand Down
12 changes: 12 additions & 0 deletions docker-compose.extend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3'
services:
workspace:
image: mcr.microsoft.com/vscode/devcontainers/python:3.11
volumes:
# Mounts the project folder to '/workspace'. While this file is in .devcontainer,
# mounts are relative to the first file in the list, which is a level up.
- .:/workspace:cached
command: /bin/sh -c "while sleep 1000; do :; done"
env_file:
- ./.envs/.local/.django
- ./.envs/.local/.postgres
Loading

0 comments on commit e0f53b3

Please sign in to comment.