Update CSS optimization (using CDN for bootstrap) and mysql compat
This commit is contained in:
@@ -3,6 +3,14 @@ SECRET_KEY=django-insecure-change-me
|
|||||||
DEBUG=True
|
DEBUG=True
|
||||||
ALLOWED_HOSTS=localhost,127.0.0.1
|
ALLOWED_HOSTS=localhost,127.0.0.1
|
||||||
|
|
||||||
|
# MySQL (opcional, si MYSQL_ENABLED=False se usa SQLite)
|
||||||
|
MYSQL_ENABLED=False
|
||||||
|
MYSQL_DATABASE=tienda
|
||||||
|
MYSQL_USER=tienda_user
|
||||||
|
MYSQL_PASSWORD=
|
||||||
|
MYSQL_HOST=127.0.0.1
|
||||||
|
MYSQL_PORT=3306
|
||||||
|
|
||||||
# Redis
|
# Redis
|
||||||
REDIS_URL=redis://127.0.0.1:6379/1
|
REDIS_URL=redis://127.0.0.1:6379/1
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ ENV PYTHONUNBUFFERED=1
|
|||||||
ENV DEBIANFRONTEND=noninteractive
|
ENV DEBIANFRONTEND=noninteractive
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN apt update && apt install -y build-essential figlet libpq-dev && rm -rf /var/lib/apt/lists/*
|
RUN apt update && apt install -y build-essential figlet libpq-dev default-libmysqlclient-dev pkg-config && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
COPY requirements.txt /app/
|
COPY requirements.txt /app/
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|||||||
+1
-1
@@ -9,4 +9,4 @@ python manage.py collectstatic --noinput
|
|||||||
|
|
||||||
echo "Running server!"
|
echo "Running server!"
|
||||||
|
|
||||||
gunicorn --bind 0.0.0.0:8000 proyecto.wsgi:application
|
gunicorn --bind 0.0.0.0:8000 proyecto.wsgi:application --forwarded-allow-ips="*"
|
||||||
Binary file not shown.
+30
-8
@@ -118,13 +118,30 @@ WSGI_APPLICATION = 'proyecto.wsgi.application'
|
|||||||
|
|
||||||
# Database
|
# Database
|
||||||
# https://docs.djangoproject.com/en/6.0/ref/settings/#databases
|
# https://docs.djangoproject.com/en/6.0/ref/settings/#databases
|
||||||
|
# Activa MySQL con MYSQL_ENABLED=True en el .env; si no, se usa SQLite.
|
||||||
|
|
||||||
DATABASES = {
|
if env_bool('MYSQL_ENABLED', False):
|
||||||
'default': {
|
DATABASES = {
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
'default': {
|
||||||
'NAME': BASE_DIR / 'db.sqlite3',
|
'ENGINE': 'django.db.backends.mysql',
|
||||||
|
'NAME': os.getenv('MYSQL_DATABASE', 'tienda'),
|
||||||
|
'USER': os.getenv('MYSQL_USER', 'root'),
|
||||||
|
'PASSWORD': os.getenv('MYSQL_PASSWORD', ''),
|
||||||
|
'HOST': os.getenv('MYSQL_HOST', '127.0.0.1'),
|
||||||
|
'PORT': env_int('MYSQL_PORT', 3306),
|
||||||
|
'OPTIONS': {
|
||||||
|
'charset': 'utf8mb4',
|
||||||
|
'init_command': "SET sql_mode='STRICT_TRANS_TABLES'",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
'NAME': BASE_DIR / 'db.sqlite3',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Password validation
|
# Password validation
|
||||||
@@ -328,14 +345,19 @@ EMAIL_HOST_PASSWORD = SMTP_PASSWORD
|
|||||||
DEFAULT_FROM_EMAIL = os.getenv("DEFAULT_FROM_EMAIL", SMTP_EMAIL)
|
DEFAULT_FROM_EMAIL = os.getenv("DEFAULT_FROM_EMAIL", SMTP_EMAIL)
|
||||||
|
|
||||||
# URL de Redis (asumiendo que corre en el puerto default 6379)
|
# URL de Redis (asumiendo que corre en el puerto default 6379)
|
||||||
CELERY_BROKER_URL = 'redis://localhost:6379/0'
|
CELERY_BROKER_URL = os.getenv("REDIS_URL", "redis://localhost:6379/0")
|
||||||
|
|
||||||
# Opcional: para guardar el resultado de las tareas
|
# Opcional: para guardar el resultado de las tareas
|
||||||
CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'
|
CELERY_RESULT_BACKEND = os.getenv("REDIS_URL", "redis://localhost:6379/0")
|
||||||
|
|
||||||
# Configuraciones adicionales recomendadas
|
# Configuraciones adicionales recomendadas
|
||||||
CELERY_ACCEPT_CONTENT = ['json']
|
CELERY_ACCEPT_CONTENT = ['json']
|
||||||
CELERY_TASK_SERIALIZER = 'json'
|
CELERY_TASK_SERIALIZER = 'json'
|
||||||
CELERY_RESULT_SERIALIZER = 'json'
|
CELERY_RESULT_SERIALIZER = 'json'
|
||||||
|
|
||||||
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
|
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
|
||||||
|
|
||||||
|
USE_X_FORWARDED_HOST = True
|
||||||
|
SECURE_REFERER_POLICY = "strict-origin-when-cross-origin"
|
||||||
|
|
||||||
|
print(f"DEBUG: ALLOWED_HOSTS is {ALLOWED_HOSTS}")
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
mysqlclient>=2.2.0
|
||||||
amqp==5.3.1
|
amqp==5.3.1
|
||||||
asgiref==3.11.0
|
asgiref==3.11.0
|
||||||
billiard==4.2.4
|
billiard==4.2.4
|
||||||
|
|||||||
+2
-9762
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -1,5 +1,4 @@
|
|||||||
@use 'sass:list';
|
@use 'sass:list';
|
||||||
@import "bootstrap/bootstrap";
|
|
||||||
$priceColor: #5abf5a;
|
$priceColor: #5abf5a;
|
||||||
$primaryColor: (
|
$primaryColor: (
|
||||||
#FE8D90,
|
#FE8D90,
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Document</title>
|
<title>Document</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
|
||||||
<link rel="preload" href="{% static 'css/custom.css' %}" as="style" onload="this.onload=null;this.rel='stylesheet'">
|
<link rel="preload" href="{% static 'css/custom.css' %}" as="style" onload="this.onload=null;this.rel='stylesheet'">
|
||||||
<noscript><link rel="stylesheet" href="{% static 'css/custom.css' %}"></noscript>
|
<noscript><link rel="stylesheet" href="{% static 'css/custom.css' %}"></noscript>
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
Reference in New Issue
Block a user