簡體   English   中英

DJANGO CRUD 沒有名為“django.contrib.name”的模塊

[英]DJANGO CRUD No module named 'django.contrib.name'

當我打開 cmd 並命令這個python manage.py makemigrations然后我遇到了這個大問題。 我不明白該怎么做。

Traceback (most recent call last):
  File "C:\Users\s\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\apps\config.py", line 118, in create
    cls = getattr(mod, cls_name)
AttributeError: module 'django.contrib' has no attribute 'name'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Users\s\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "C:\Users\s\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\__init__.py", line 347, in execute
    django.setup()
  File "C:\Users\s\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Users\s\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\apps\registry.py", line 89, in populate
    app_config = AppConfig.create(entry)
  File "C:\Users\s\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\apps\config.py", line 123, in create
    import_module(entry)
  File "C:\Users\s\AppData\Local\Programs\Python\Python37-32\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'django.contrib.name'

我應該從 setting.py 文件中更改什么?:

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.name',
'django.contrib.email',
'django.contrib.address',
'django.contrib.phone',

]

問題是沒有命名的模塊

django.contrib.name

這就是 Django 實際上告訴你的。 INSTALLED_APPS 變量適用於您在項目和您創建的應用程序中使用的 Django 模塊。 刪除那些:

'django.contrib.name',
'django.contrib.email',
'django.contrib.address',
'django.contrib.phone',

運行遷移,它應該可以工作。 告訴我你想用這些名字 email、地址和電話變量做什么,我會盡力幫助你。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM