Raise ImproperlyConfigured(msg)

raise ImproperlyConfigured(msg)

In "additional_app", in "models.py":

from django.db import models
from django.contrib.auth import get_user_model

User = get_user_model()

class Profile(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    id_user = models.IntegerField()
    bio = models.TextField(max_length=500, blank=True)
    profileimg = models.ImageField(upload_to='profile_images', default='btm-banner.png')
    location = models.CharField(max_length=100, blank=True)

    def __str__(self):
        return self.user.username

I have created 'media_folder' in "additional_app" and put into img 'btm-banner.png' to django load it if user dont load self picture in profile.

Also i write in settings.py:

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

Also in 'main_app', in urls.py:

from django.conf import settings
from django.conf.urls.static import static

urlpatterns = urlpatterns + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

Now i want make 'migration' In Terminal:

S:\Programms\Projects\social_app\main_app> py manage.py makemigration


Result: django.core.exceptions.ImproperlyConfigured: additional_app.apps.AdditionalAppConfig.default_auto_field refers to the module 'django.db.media .BigAutoField' that could not be imported.

Back to Top