The media folder is not created after saving the file in the database Django

I`m writing a site on Django and I faced a problem. I have a cv field in the database, in which users can store their resume, I did everything as stated in the documentation. Namely:

  1. Create FileField model in

    class JobseekerProfileInfo(models.Model):
    jobseeker = models.OneToOneField(JobseekerRegisterInfo, on_delete=models.CASCADE)
    photo = models.ImageField(upload_to='avatars/%Y/%m/%d',
    expected_job = models.CharField(max_length=400, blank=True)
    telegram = models.CharField(max_length=150, blank=True)
    linkedin = models.URLField(blank=True)
    git_hub = models.URLField(blank=True)
    cv = models.FileField(upload_to='cvs/%Y/%m/%d')
    active_search = models.BooleanField(default=True)
    def __str__(self):
        return self.expected_job

    Notice the FileField, I specified the upload_to argument

  2. Created a MEDIA_ROOT and MEDIA_URL variables in

    MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
    MEDIA_URL = '/media/'
  3. Added static() to urlpatterns list in

    from django.contrib import admin
    from django.urls import path, include
    from django.conf.urls.static import static
    from django.conf import settings
    import debug_toolbar
     urlpatterns = [
         path('', include('main_page.urls')),
         path('jobseeker', include('jobseeker.urls')),
         path('profile', include('personal_profile.urls')),
         path('__debug__/', include('debug_toolbar.urls')),
     ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
     urlpatterns += [
         path('captcha/', include('captcha.urls'))

But when I added file to db, media root doesn`t create Help me please

Back to Top