django-template/README.md

125 lines
1.5 KiB
Markdown
Raw Normal View History

2021-04-01 09:48:35 +02:00
# Install
2021-07-01 09:46:33 +02:00
``` sh
make docker.recreate.django
make run.loaddata
make run.server
```
Now open:
2021-04-01 09:48:35 +02:00
`http://project.localhost`
2021-04-01 09:48:35 +02:00
## Gulp
```shell
npm i
```
Run.
```shell
gulp dev
```
2021-07-01 09:46:33 +02:00
## Tools
Lint
```shell
make lint
2021-04-01 09:48:35 +02:00
```
2021-07-01 09:46:33 +02:00
Formatear
2021-04-01 09:48:35 +02:00
2021-07-01 09:46:33 +02:00
```shell
make format
2021-04-01 09:48:35 +02:00
```
2021-07-01 09:46:33 +02:00
Recrear imagen de Django
2021-04-01 09:48:35 +02:00
2021-07-01 09:46:33 +02:00
```shell
make docker.recreate.django
2021-04-01 09:48:35 +02:00
```
2021-07-01 09:46:33 +02:00
Hacer una nueva migración después de cambiar un model.
2021-04-01 09:48:35 +02:00
2021-07-01 09:46:33 +02:00
```shell
make makemigrations
```
Migrar
```shell
make run.migrate
```
Cargar data mínima.
```shell
make run.loaddata
```
Generar data de desarrollo.
```shell
make run.loaddata.test
```
2021-04-01 09:48:35 +02:00
2021-07-01 09:46:33 +02:00
## Other domains
2021-04-01 09:48:35 +02:00
- Caddy: `http://project.localhost`.
- Gulp: `http://project.localhost:3000`.
- Django: `http://project.localhost:8000`.
- Mailhog: `http://project.localhost:8025`.
2021-04-01 09:48:35 +02:00
### Bash Django
``` shell
docker exec -it project-django bash
2021-04-01 09:48:35 +02:00
```
# Run production
``` sh
2021-04-01 09:58:13 +02:00
docker-compose -f docker-compose.pro.yaml up
2021-04-01 09:48:35 +02:00
```
Open `https://proyect.com`.
2022-07-29 15:15:22 +02:00
# Enviroment (.env)
```text
2022-08-02 08:56:52 +02:00
PROJECT_NAME=project
2022-07-29 15:15:22 +02:00
# Domain
DOMAIN=project.localhost
DOMAIN_URL=http://project.localhost
2022-07-29 15:15:22 +02:00
# Database
2022-08-01 15:52:14 +02:00
DB_NAME=project_db
2022-07-29 15:15:22 +02:00
DB_USER=postgres
DB_PASSWORD=postgres
DB_HOST=postgresql
DB_PORT=5432
# Django options
DJANGO_SECRET_KEY=mysecret
# Redis
2022-08-09 11:02:24 +02:00
REDIS_URI="redis://:@redis:6379"
2022-07-29 15:15:22 +02:00
# Caddy
CADDY_PORT_ONE=80
CADDY_PORT_TWO=443
# Email
DEFAULT_FROM_EMAIL=no-reply@project.localhost
EMAIL_CONTACT=info@project.localhost
2022-07-29 15:15:22 +02:00
EMAIL_HOST=mailhog
EMAIL_USER=
EMAIL_PASSWORD=
EMAIL_PORT=1025
EMAIL_USE_TLS=False
EMAIL_USE_SSL=False
2022-08-09 11:02:24 +02:00
```