ModuleNotFoundError:没有名为' backend'的模块在django-admin中

时间:2018-05-05 18:00:38

标签: python django python-3.x

当我使用django-admin startproject anil开始一个新项目时,我收到此错误:

Traceback (most recent call last):
  File "c:\users\gsrnation\appdata\local\programs\python\python36-32\Lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\gsrnation\appdata\local\programs\python\python36-32\Lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\gsrnation\Desktop\sp\venv\Scripts\django-admin.exe\__main__.py", line 9, in <module>
  File "c:\users\gsrnation\desktop\sp\venv\lib\site-packages\django\core\management\__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "c:\users\gsrnation\desktop\sp\venv\lib\site-packages\django\core\management\__init__.py", line 317, in execute
    settings.INSTALLED_APPS
  File "c:\users\gsrnation\desktop\sp\venv\lib\site-packages\django\conf\__init__.py", line 56, in __getattr__
    self._setup(name)
  File "c:\users\gsrnation\desktop\sp\venv\lib\site-packages\django\conf\__init__.py", line 43, in _setup
    self._wrapped = Settings(settings_module)
  File "c:\users\gsrnation\desktop\sp\venv\lib\site-packages\django\conf\__init__.py", line 106, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "c:\users\gsrnation\desktop\sp\venv\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'backend'

我甚至做了一个virtualenv但仍然出现同样的错误。我的django版本是Django == 2.0.5,python版本是python 3.6.5。 我尝试运行我以前的django项目,但仍然出现相同的错误。

1 个答案:

答案 0 :(得分:0)

GoodDay Brother,

确保已在项目settings.py文件中更新了新的Django应用名称。新的应用名称应该用单引号引起来,并用逗号隔开。

  

INSTALLED_APPS = [       'newAppName',       'django.contrib.admin',       'django.contrib.auth',       'django.contrib.contenttypes',       'django.contrib.sessions',       'django.contrib.messages',       'django.contrib.staticfiles',]