diff --git a/RepostajesDj/vehiculos/.gitignore b/RepostajesDj/vehiculos/.gitignore index 5193978..3bce56c 100644 --- a/RepostajesDj/vehiculos/.gitignore +++ b/RepostajesDj/vehiculos/.gitignore @@ -13,4 +13,3 @@ Thumbs.db *.log db.sqlite3 -mediafiles/ diff --git a/RepostajesDj/vehiculos/accounts/.gitignore b/RepostajesDj/vehiculos/accounts/.gitignore new file mode 100644 index 0000000..62616c7 --- /dev/null +++ b/RepostajesDj/vehiculos/accounts/.gitignore @@ -0,0 +1 @@ +migrations/ diff --git a/RepostajesDj/vehiculos/accounts/migrations/__init__.py b/RepostajesDj/vehiculos/accounts/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/RepostajesDj/vehiculos/entornoPruebas.sh b/RepostajesDj/vehiculos/entornoPruebas.sh index 0d6d9e6..61cd4df 100644 --- a/RepostajesDj/vehiculos/entornoPruebas.sh +++ b/RepostajesDj/vehiculos/entornoPruebas.sh @@ -1,5 +1,5 @@ -export CSRF_TRUSTED_ORIGINS="localhost" -export DEBUG=1 +export CSRF_TRUSTED_ORIGINS="http://localhost" +export DEBUG="True" export SECRET_KEY="hola" export DJANGO_ALLOWED_HOSTS="localhost" diff --git a/RepostajesDj/vehiculos/mediafiles/profile_images/default.jpg b/RepostajesDj/vehiculos/mediafiles/profile_images/default.jpg new file mode 100644 index 0000000..c3d6ff4 Binary files /dev/null and b/RepostajesDj/vehiculos/mediafiles/profile_images/default.jpg differ diff --git a/RepostajesDj/vehiculos/mediafiles/profile_images/gravatar-tino.jpeg b/RepostajesDj/vehiculos/mediafiles/profile_images/gravatar-tino.jpeg new file mode 100644 index 0000000..98ef9b0 Binary files /dev/null and b/RepostajesDj/vehiculos/mediafiles/profile_images/gravatar-tino.jpeg differ diff --git a/RepostajesDj/vehiculos/mediafiles/profile_images/gravatar-tino_jqB0Vq4.jpeg b/RepostajesDj/vehiculos/mediafiles/profile_images/gravatar-tino_jqB0Vq4.jpeg new file mode 100644 index 0000000..98ef9b0 Binary files /dev/null and b/RepostajesDj/vehiculos/mediafiles/profile_images/gravatar-tino_jqB0Vq4.jpeg differ diff --git a/RepostajesDj/vehiculos/mediafiles/vehiculos/bmw.jpg b/RepostajesDj/vehiculos/mediafiles/vehiculos/bmw.jpg new file mode 100644 index 0000000..88723ad Binary files /dev/null and b/RepostajesDj/vehiculos/mediafiles/vehiculos/bmw.jpg differ diff --git a/RepostajesDj/vehiculos/repostajes/migrations/0001_initial.py b/RepostajesDj/vehiculos/repostajes/migrations/0001_initial.py index 922476f..c6a9381 100644 --- a/RepostajesDj/vehiculos/repostajes/migrations/0001_initial.py +++ b/RepostajesDj/vehiculos/repostajes/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 4.2 on 2024-08-29 08:38 +# Generated by Django 4.2 on 2024-09-02 10:06 from django.db import migrations, models import django.db.models.deletion @@ -28,13 +28,13 @@ class Migration(migrations.Migration): fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('fecha', models.DateField()), - ('kms', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)), - ('litros', models.DecimalField(blank=True, decimal_places=2, max_digits=4, null=True)), - ('descuento', models.DecimalField(blank=True, decimal_places=2, max_digits=4, null=True)), - ('importe', models.DecimalField(blank=True, decimal_places=2, max_digits=6, null=True)), - ('precioxlitro', models.DecimalField(blank=True, decimal_places=2, max_digits=4, null=True)), - ('kmsrecorridos', models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True)), - ('consumo', models.DecimalField(blank=True, decimal_places=2, max_digits=4, null=True)), + ('kms', models.DecimalField(blank=True, decimal_places=0, max_digits=10, null=True)), + ('litros', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)), + ('descuento', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)), + ('importe', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)), + ('precioxlitro', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)), + ('kmsrecorridos', models.DecimalField(blank=True, decimal_places=0, max_digits=10, null=True)), + ('consumo', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)), ('vehiculo', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='repostajes.vehiculo')), ], ), @@ -46,7 +46,7 @@ class Migration(migrations.Migration): ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), ('email', models.EmailField(max_length=254, unique=True, verbose_name='email address')), - ('foto', models.ImageField(blank=True, upload_to='profile_images')), + ('foto', models.ImageField(blank=True, default='profile_images/default.jpg', upload_to='profile_images')), ('is_staff', models.BooleanField(default=False)), ('is_active', models.BooleanField(default=True)), ('nombre', models.CharField(blank=True, max_length=200, null=True)), diff --git a/RepostajesDj/vehiculos/repostajes/models.py b/RepostajesDj/vehiculos/repostajes/models.py index ed4f113..a42fa59 100644 --- a/RepostajesDj/vehiculos/repostajes/models.py +++ b/RepostajesDj/vehiculos/repostajes/models.py @@ -42,7 +42,7 @@ class Repostaje(models.Model): class ReyMotaUser(AbstractBaseUser, PermissionsMixin): email = models.EmailField(_("email address"), unique=True) - foto = models.ImageField(upload_to="profile_images", blank=True) + foto = models.ImageField(upload_to="profile_images", default="profile_images/default.jpg", blank=True) is_staff = models.BooleanField(default=False) is_active = models.BooleanField(default=True) nombre = models.CharField(max_length=200, blank=True, null=True) diff --git a/RepostajesDj/vehiculos/vehiculos/settings.py b/RepostajesDj/vehiculos/vehiculos/settings.py index 1c56b25..b2bc28c 100644 --- a/RepostajesDj/vehiculos/vehiculos/settings.py +++ b/RepostajesDj/vehiculos/vehiculos/settings.py @@ -25,6 +25,7 @@ SECRET_KEY = os.environ.get("SECRET_KEY") # SECURITY WARNING: don't run with debug turned on in production! DEBUG = os.environ["DEBUG"] == 'True' +print("DEBUG: ", DEBUG) ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS").split(" ") @@ -143,5 +144,5 @@ AUTH_USER_MODEL = "repostajes.ReyMotaUser" MEDIA_ROOT = BASE_DIR / "mediafiles" MEDIA_URL = '/media/' -# if DEBUG is False: -CSRF_TRUSTED_ORIGINS = os.environ.get("CSRF_TRUSTED_ORIGINS").split(" ") +if DEBUG is False: + CSRF_TRUSTED_ORIGINS = os.environ.get("CSRF_TRUSTED_ORIGINS").split(" ") diff --git a/RepostajesDj/vehiculos/vehiculos/urls.py b/RepostajesDj/vehiculos/vehiculos/urls.py index 1b22792..2bf4f27 100644 --- a/RepostajesDj/vehiculos/vehiculos/urls.py +++ b/RepostajesDj/vehiculos/vehiculos/urls.py @@ -31,7 +31,7 @@ urlpatterns = [ path("", TemplateView.as_view(template_name="repostajes/index.html"), name="principal"), # new -] +] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) if not settings.DEBUG: urlpatterns += static(settings.MEDIA_URL,