Maybe about the sys.path

Hi, There is a problem. I've installed django-cart into my project. And in, I import it as:

from cart.cart import Cart

But it keeps showing that in the, ModuleNotFoundError, which is related to this line:

import models

There is a located at the same folder with, the folder is


And I also try to add this path to the sys.path, which makes my sys.path looks like this:

['', '/home/adrop/venv/lib/', '/home/adrop/venv/lib/python3.6', '/home/adrop/venv/lib/python3.6/lib-dynload', '/usr/lib/pyth on3.6', '/home/adrop/venv/lib/python3.6/site-packages', '/home/adrop/venv/lib/python3.6/site-packages/cart']

And it refused to find as well.

So, is there anything I missed?

Can we take a look at your files? We can see them from our admin interface, but we always ask for permission first.

Yes, please

Hi there,

it looks like your most recent error is:

RuntimeError: Model class mycart.models.Cart doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

that's a different error? Perhaps you need to add something to INSTALLED_APPS in

I've copy the to another folder, and temporary remove the error and come up with the new error.

I'll change it back and please take a look again.

Thank you.

At line 15 in mainsite/, you have

from cart.cart import Cart

Should that be

from mycart.models import Cart


Or are you trying to use a third-party module called "cart" that you've installed into your virtualenv? If so, it looks like that module is broken...

yes, I've trying to use a third-party module called "cart" which I've already installed.

That's an old module, I found out these few days. It must have some problems.

But what's confusing, is why and located at the same folder, yet couldn't include Is it normal?

I create a folder "mycart" under my project, and copy to this folder.

And then in /home/adrop/venv/lib/python3.6/site-packages/cart/

I import this as

import mycart.models

It can be included. But just can't import it from the same folder.

If the folder is not on the Python path, then you will not be able to import directly from it.

In my first post, I listed the sys.path, and the folder is listed in it. Is sys.path Python path? I'm a little confused.

Have a look at It has a really good description of how Python tries to find modules that you import.