Import Error name

Let me explain.

  1. I made a folder Mainf in sc folder
    sc folder is Startapp
    2- So in Installed_app Settins I configure
    ‘sc.Mainf’
    3- in Mainf I got my Models to migrate

when I run python manage.py makemigrations send me this message.

django.core.exceptions.ImproperlyConfigured: Cannot import ‘Mainf’. Check that ‘sc.Mainf.apps.MainfConfig.name’ is correct.

Any help please

I’m not understanding your directory structure as you’re trying to describe it.

Typically, you start with a project directory. Then you have your apps within that project directory - including an app directory as the same name as the project.

For example, if you use startproject myproject, you’ll have:

myproject/
    manage.py
    myproject/
        __init__.py
        settings.py
        urls.py
        wsgi.py
        asgi.py

If you then make that outer myproject your current directory, the startapp command will make the app directory.

So if you do startapp myapp, you end up with:

myproject/
    manage.py
    myproject/
        __init__.py
        settings.py
        urls.py
        wsgi.py
        asgi.py
    myapp/
        __init__.py
        admin.py
        apps.py
        models.py
        tests.py
        views.py
        migrations/
            __init__.py

This is the common starting point as used by the default Django tools and shown in the tutorial.

Please clarify what the directory structure is that you have created. Also post your INSTALLED_APPS setting.

I’m sorry, I can’t quite read the screen images, but from what I think I can tell, you’ve got this Mainf directory inside another app directory.

Why are you trying to do it this way? Is there some reason for it?

If you’re not familiar with Django’s structure and how apps are configured and how the imports work, you’re going to encounter fewer issues if you stick with the standard directory layouts.

That correct.
The startapp directory is sc.
Inside I got a directory Mainf