Olá Pessoal, boa tarde!
Estimo que esteja tudo bem.
Na parte de fazer o upload está dando erro!
SystemCheckError: System check identified some issues:
ERRORS:
galeria.Fotografia.foto: (fields.E210) Cannot use ImageField because Pillow is not installed.
HINT: Get Pillow at https://pypi.org/project/Pillow/ or run command "python -m pip install Pillow".
# settings.py
# Media
MEDIA_ROOT = os.path.join(BASE_DIR, "media/")
MEDIA_URL = "/media/"
# setup/urls.py
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('galeria.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
# models.py
from django.db import models
from datetime import datetime
class Fotografia(models.Model):
OPCOES_CATEGORIA = [
("NEBULOSA", "Nebulosa"),
("ESTRELA", "Estrela"),
("GALÁXIA", "Galáxia"),
("PLANETA", "Planeta")
]
nome = models.CharField(max_length=100, null=False, blank=False)
legenda = models.CharField(max_length=150, null=False, blank=False)
categoria = models.CharField(max_length=100, choices=OPCOES_CATEGORIA, default='')
descricao = models.TextField(null=False, blank=False)
foto = models.ImageField(upload_to="fotos/%Y/%m/%d/", blank=True)
publicada = models.BooleanField(default=False)
data_fotografia = models.DateTimeField(default=datetime.now, blank=False)
def __str__(self):
return f"Fotografia [nome={self.nome}]"
Por gentileza , poderia me ajudar.
Obrigado!!!