Hello i can't upload the file, i'm in a debug mode: the urls.is:
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('', include('polls.urls')), path('admin/', admin.site.urls), ] if settings.DEBUG is True: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) The model is: class Disegni(models.Model): iddisegni = models.AutoField(primary_key=True) descrizione = models.CharField(max_length=45, blank=True, null=True) revisione = models.CharField(max_length=45, blank=True, null=True) file = models.FileField(upload_to='disegni/', blank=True, null=True) class Meta: managed = False db_table = 'disegni' the forms is: class DisegniForm(forms.ModelForm): class Meta: model = Disegni fields = ('iddisegni', 'descrizione', 'revisione', 'file') labels = {'descrizione':'Descrizione', 'revisione':'Revisione', 'file':'File'} The settings.py is: STATIC_URL = '/static/' MEDIA_URL = '/media/' STATIC_ROOT = "E:/dngo/mysite/polls/static" MEDIA_ROOT = "E:/dngo/mysite/polls/media" the template is generated The template is just : {% load static %} <head> <link rel="stylesheet" href="{%static "regole.css" %}"> </head> <form form action="salvo_nuovo" method="post">{% csrf_token %} {{ form.as_p }} <button type="submit">Salva</button> </form> I never get errors but the file is not uploaded Where is my mistake? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a8713cc3-2a4c-42ba-8c54-976e1a4b8090%40googlegroups.com.