Serv Media Files

This commit is contained in:
jp.dev 2020-11-20 15:43:51 -03:00
parent 789acccca1
commit 977f746f2d
3 changed files with 11 additions and 1 deletions

View File

@ -120,6 +120,10 @@ USE_TZ = True
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'media'
# Configuracion correo electronico
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'

View File

@ -1,5 +1,8 @@
from django.urls import path
from ProyectoWebApp import views
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('', views.home, name="Inicio"),
@ -9,3 +12,6 @@ urlpatterns = [
path('contacto', views.contacto, name='Contacto'),
path('sample/', views.sample, name ='Sample'),
]
urlpatterns += static(settings.MEDIA_URL, document_root = settings.MEDIA_ROOT)

View File

@ -5,7 +5,7 @@ from django.db import models
class Servicio(models.Model):
titulo = models.CharField( max_length = 50 )
contenido = models.CharField( max_length = 50 )
imagen = models.ImageField()
imagen = models.ImageField(upload_to = 'servicios')
created = models.DateTimeField( auto_now_add = True)
updated = models.DateTimeField( auto_now_add = True)