diff --git a/essenza/essenza/settings.py b/essenza/essenza/settings.py index 662ee0e..5f487b8 100644 --- a/essenza/essenza/settings.py +++ b/essenza/essenza/settings.py @@ -122,6 +122,11 @@ STATIC_URL = 'static/' STATICFILES_DIRS = [BASE_DIR / 'static'] +STATIC_ROOT = BASE_DIR / 'staticfiles' + +MEDIA_URL = '/media/' +MEDIA_ROOT = BASE_DIR / 'media' + # Default primary key field type # https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field diff --git a/essenza/essenza/urls.py b/essenza/essenza/urls.py index 8ee6270..a4a755e 100644 --- a/essenza/essenza/urls.py +++ b/essenza/essenza/urls.py @@ -2,10 +2,15 @@ from django.urls import path, include from info.views import info_view from product.views import DashboardView +from django.conf import settings +from django.conf.urls.static import static urlpatterns = [ path('info/', info_view, name='info-home'), path("user/", include("user.urls")), path('admin/', admin.site.urls), path('', DashboardView.as_view(), name='dashboard') -] \ No newline at end of file +] + +if settings.DEBUG: + urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) \ No newline at end of file diff --git a/essenza/media/profile_pics/admin.png b/essenza/media/profile_pics/admin.png new file mode 100644 index 0000000..dff3fbd Binary files /dev/null and b/essenza/media/profile_pics/admin.png differ diff --git a/essenza/profile_pics/user1.avif b/essenza/media/profile_pics/ana_martin.jpg similarity index 100% rename from essenza/profile_pics/user1.avif rename to essenza/media/profile_pics/ana_martin.jpg diff --git a/essenza/profile_pics/user3.avif b/essenza/media/profile_pics/carla_gonzalez.jpg similarity index 100% rename from essenza/profile_pics/user3.avif rename to essenza/media/profile_pics/carla_gonzalez.jpg diff --git a/essenza/profile_pics/user2.avif b/essenza/media/profile_pics/juan_perez.jpg similarity index 100% rename from essenza/profile_pics/user2.avif rename to essenza/media/profile_pics/juan_perez.jpg diff --git a/essenza/product/models.py b/essenza/product/models.py index 12d3621..cba51f0 100644 --- a/essenza/product/models.py +++ b/essenza/product/models.py @@ -13,7 +13,7 @@ class Product(models.Model): category = models.CharField(max_length=20, choices=Category.choices) brand = models.CharField(max_length=255) price = models.DecimalField(max_digits=10, decimal_places=2) - photo = models.ImageField(upload_to='profile_pics/', null=True, blank=True) + photo = models.ImageField(upload_to='products/', null=True, blank=True) stock = models.IntegerField() is_active = models.BooleanField(default=False) diff --git a/essenza/product/sample/sample.json b/essenza/product/sample/sample.json index 2f3e04a..df6aff4 100644 --- a/essenza/product/sample/sample.json +++ b/essenza/product/sample/sample.json @@ -8,7 +8,7 @@ "category": "maquillaje", "brand": "L'Oréal", "price": 19.99, - "photo": "https://example.com/images/maquillaje_base.jpg", + "photo": "products/maquillaje_base.jpg", "stock": 50, "is_active": true } @@ -22,7 +22,7 @@ "category": "tratamiento", "brand": "Pantene", "price": 6.99, - "photo": "https://example.com/images/shampoo_reconstructivo.jpg", + "photo": "products/shampoo_reconstructivo.jpg", "stock": 100, "is_active": true } @@ -36,7 +36,7 @@ "category": "herramienta", "brand": "Braun", "price": 45.99, - "photo": "https://example.com/images/secador_pelo.jpg", + "photo": "products/secador_pelo.jpg", "stock": 30, "is_active": true } @@ -50,7 +50,7 @@ "category": "perfume", "brand": "Chanel", "price": 79.99, - "photo": "https://example.com/images/perfume_floral.jpg", + "photo": "products/perfume_floral.jpg", "stock": 20, "is_active": true } @@ -64,7 +64,7 @@ "category": "tratamiento", "brand": "Nivea", "price": 12.99, - "photo": "https://example.com/images/crema_hidratante.jpg", + "photo": "products/crema_hidratante.jpg", "stock": 150, "is_active": true } @@ -78,7 +78,7 @@ "category": "herramienta", "brand": "Remington", "price": 29.99, - "photo": "https://example.com/images/rizador_pelo.jpg", + "photo": "products/rizador_pelo.jpg", "stock": 40, "is_active": true } @@ -92,7 +92,7 @@ "category": "tratamiento", "brand": "Dettol", "price": 4.99, - "photo": "https://example.com/images/gel_antibacterial.jpg", + "photo": "products/gel_antibacterial.jpg", "stock": 200, "is_active": true } @@ -106,7 +106,7 @@ "category": "tratamiento", "brand": "Head & Shoulders", "price": 7.99, - "photo": "https://example.com/images/shampoo_anticaspa.jpg", + "photo": "products/shampoo_anticaspa.jpg", "stock": 90, "is_active": true } @@ -120,7 +120,7 @@ "category": "tratamiento", "brand": "Argan Oil", "price": 15.99, - "photo": "https://example.com/images/aceite_capilar.jpg", + "photo": "products/aceite_capilar.jpg", "stock": 60, "is_active": true } @@ -134,7 +134,7 @@ "category": "cabello", "brand": "Garnier", "price": 8.99, - "photo": "https://example.com/images/tinte_cabello.jpg", + "photo": "products/tinte_cabello.jpg", "stock": 110, "is_active": true } @@ -148,7 +148,7 @@ "category": "tratamiento", "brand": "L'Oréal", "price": 18.99, - "photo": "https://example.com/images/mascarilla_facial.jpg", + "photo": "products/mascarilla_facial.jpg", "stock": 80, "is_active": true } @@ -162,7 +162,7 @@ "category": "tratamiento", "brand": "TRESemmé", "price": 5.99, - "photo": "https://example.com/images/shampoo_voluminizador.jpg", + "photo": "products/shampoo_voluminizador.jpg", "stock": 120, "is_active": true } @@ -176,7 +176,7 @@ "category": "cabello", "brand": "Schwarzkopf", "price": 10.99, - "photo": "https://example.com/images/laca_pelo.jpg", + "photo": "products/laca_pelo.jpg", "stock": 70, "is_active": true } @@ -190,7 +190,7 @@ "category": "tratamiento", "brand": "Hawaiian Tropic", "price": 14.99, - "photo": "https://example.com/images/crema_solar.jpg", + "photo": "products/crema_solar.jpg", "stock": 40, "is_active": true } @@ -204,7 +204,7 @@ "category": "tratamiento", "brand": "Olay", "price": 25.99, - "photo": "https://example.com/images/crema_antiedad.jpg", + "photo": "products/crema_antiedad.jpg", "stock": 30, "is_active": true } @@ -218,7 +218,7 @@ "category": "tratamiento", "brand": "Dove", "price": 3.99, - "photo": "https://example.com/images/desodorante.jpg", + "photo": "products/desodorante.jpg", "stock": 150, "is_active": true } @@ -232,7 +232,7 @@ "category": "tratamiento", "brand": "Neutrogena", "price": 4.49, - "photo": "https://example.com/images/toallitas_desmaquillantes.jpg", + "photo": "products/toallitas_desmaquillantes.jpg", "stock": 90, "is_active": true } @@ -246,7 +246,7 @@ "category": "maquillaje", "brand": "Real Techniques", "price": 12.99, - "photo": "https://example.com/images/pincel_maquillaje.jpg", + "photo": "products/pincel_maquillaje.jpg", "stock": 110, "is_active": true } @@ -260,7 +260,7 @@ "category": "tratamiento", "brand": "Eucerin", "price": 9.99, - "photo": "https://example.com/images/crema_pies.jpg", + "photo": "products/crema_pies.jpg", "stock": 80, "is_active": true } @@ -274,7 +274,7 @@ "category": "tratamiento", "brand": "Neutrogena", "price": 7.49, - "photo": "https://example.com/images/limpieza_facial.jpg", + "photo": "products/limpieza_facial.jpg", "stock": 130, "is_active": true } diff --git a/essenza/profile_pics/img1.jpg b/essenza/profile_pics/img1.jpg deleted file mode 100644 index 64ca02d..0000000 Binary files a/essenza/profile_pics/img1.jpg and /dev/null differ diff --git a/essenza/requirements.txt b/essenza/requirements.txt new file mode 100644 index 0000000..e81440b --- /dev/null +++ b/essenza/requirements.txt @@ -0,0 +1,5 @@ +asgiref==3.10.0 +Django==5.2.8 +pillow==12.0.0 +sqlparse==0.5.3 +tzdata==2025.2 diff --git a/essenza/static/images/default_user.png b/essenza/static/images/default_user.png new file mode 100644 index 0000000..ada81e2 Binary files /dev/null and b/essenza/static/images/default_user.png differ diff --git a/essenza/templates/product/dashboard.html b/essenza/templates/product/dashboard.html index 9022f47..5472c98 100644 --- a/essenza/templates/product/dashboard.html +++ b/essenza/templates/product/dashboard.html @@ -200,7 +200,7 @@ {% if user.is_authenticated %} - Mi perfil + Mi perfil
-