Skip to content

Commit 11dcbf9

Browse files
committed
2 parents 9c071ca + 6bbd933 commit 11dcbf9

4 files changed

Lines changed: 45 additions & 6 deletions

File tree

.env.example

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Archivo de ejemplo para variables de entorno
2+
3+
# Django
4+
SECRET_KEY=pon-tu-clave-secreta-aqui
5+
DEBUG=True
6+
ALLOWED_HOSTS=localhost,127.0.0.1
7+
8+
DB_ENGINE=django.db.backends.sqlite3
9+
DB_NAME=codigo/db.sqlite3
10+
DB_USER=
11+
DB_PASSWORD=
12+
DB_HOST=
13+
DB_PORT=
14+
15+
# Stripe
16+
STRIPE_PUBLIC_KEY=pk_test_xxx
17+
STRIPE_SECRET_KEY=sk_test_xxx

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,31 @@ El siguiente diagrama muestran la planificación del proyecto:
7272
pip install -r requirements.txt
7373
```
7474

75-
4. Realizar migraciones:
75+
4. Crear migraciones:
7676
```
7777
python codigo/manage.py migrate
7878
```
7979

80+
5. Realizar migraciones:
81+
```
82+
python codigo/manage.py makemigrations
83+
```
8084
5. Crear superusuario:
8185
```
8286
python codigo/manage.py createsuperuser
8387
```
88+
5. Ejecutar:
89+
```
90+
python -m daphne -p 8000 blablacar.asgi:application
91+
```
92+
93+
## Configuración de variables de entorno
94+
95+
Antes de ejecutar el proyecto, copia el archivo `.env.example` como `.env` en la raíz del proyecto y personaliza los valores según tu entorno:
96+
97+
```bash
98+
cp .env.example .env
99+
```
84100

85101
## Flujo de desarrollo recomendado
86102

@@ -166,6 +182,7 @@ charlacar/
166182
│ ├── payments/ # Procesamiento de pagos
167183
│ ├── reports/ # Generación de informes
168184
│ ├── reviews/ # Sistema de valoraciones
185+
│ ├── dashboard/ # Panel de administración
169186
│ ├── rides/ # Gestión de viajes
170187
│ ├── static/ # Archivos estáticos
171188
│ ├── templates/ # Plantillas HTML globales

codigo/blablacar/settings.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,17 @@
1919

2020
# Cargar variables de entorno desde .env
2121
load_dotenv(BASE_DIR.parent / '.env')
22+
2223
# Quick-start development settings - unsuitable for production
2324
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
2425

2526
# SECURITY WARNING: keep the secret key used in production secret!
26-
SECRET_KEY = 'django-insecure-fi1%8!9l593f*kxwgz4h4a9kwn=!&-qul)a7c25+hmuh%1vu3d'
27+
SECRET_KEY = os.getenv('SECRET_KEY', 'django-insecure-fi1%8!9l593f*kxwgz4h4a9kwn=!&-qul)a7c25+hmuh%1vu3d')
2728

2829
# SECURITY WARNING: don't run with debug turned on in production!
29-
DEBUG = True
30+
DEBUG = os.getenv('DEBUG', 'True') == 'True'
3031

31-
ALLOWED_HOSTS = []
32+
ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', '').split(',') if os.getenv('ALLOWED_HOSTS') else []
3233

3334

3435
# Application definition
@@ -96,8 +97,12 @@
9697

9798
DATABASES = {
9899
'default': {
99-
'ENGINE': 'django.db.backends.sqlite3',
100-
'NAME': BASE_DIR / 'db.sqlite3',
100+
'ENGINE': os.getenv('DB_ENGINE', 'django.db.backends.sqlite3'),
101+
'NAME': os.getenv('DB_NAME', BASE_DIR / 'db.sqlite3'),
102+
'USER': os.getenv('DB_USER', ''),
103+
'PASSWORD': os.getenv('DB_PASSWORD', ''),
104+
'HOST': os.getenv('DB_HOST', ''),
105+
'PORT': os.getenv('DB_PORT', ''),
101106
}
102107
}
103108

requirements.txt

-3.02 KB
Binary file not shown.

0 commit comments

Comments
 (0)