ImportError:没有名为 wmicodes.makes 的模块

我正在尝试在django中设置我的项目,文件夹结构似乎很好。但是,在运行该命令时,我得到一个导入错误:没有名为wmicodes.makes的模块。所以我进入了回溯,发现了一些文件,这些文件引导我找到了它。这是文件。python manage.py runserver


myfolder/myfolder/somename/models/base.py


#other imports

from wmicodes.makes import InternalMake # i get the error on this particular line

#other imports

'''The rest of the code'''

这是另一个文件 myfolder/myfolder/somename/models/init.py


from .base import *

#other imports

这是回溯:


Traceback (most recent call last):

  File "/home/mayureshkadam/Desktop/myfolder/venv/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper

    fn(*args, **kwargs)

  File "/home/mayureshkadam/Desktop/myfolder/venv/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run

    autoreload.raise_last_exception()

  File "/home/mayureshkadam/Desktop/myfolder/venv/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 249, in raise_last_exception

    six.reraise(*_exception)

  File "/home/mayureshkadam/Desktop/myfolder/venv/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper

    fn(*args, **kwargs)

  File "/home/mayureshkadam/Desktop/myfolder/venv/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup

    apps.populate(settings.INSTALLED_APPS)

  File "/home/mayureshkadam/Desktop/myfolder/venv/local/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate

    app_config.import_models(all_models)

  File "/home/mayureshkadam/Desktop/myfolder/venv/local/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models

    self.models_module = import_module(models_module_name)

  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module


我尝试找到错误,但失败了。任何指针都会有所帮助。谢谢!


喵喵时光机
浏览 64回答 1
1回答

婷婷同学_

所以我自己找到了答案。我试图找到内部内存的位置,我得到了一个python文件,我复制了绝对路径并将其包含在我的代码中from absolute path import InternalMakes这一行解决了我的错误。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python