为什么在我的django项目中创建新应用程序时出现此错误使用命令“python manage.py startapp authsss”

时间:2015-10-04 10:54:22

标签: django

追踪(最近一次呼叫最后一次):

 File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/ubunt/Desktop/myproject/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/home/ubunt/Desktop/myproject/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute
    django.setup()
  File "/home/ubunt/Desktop/myproject/local/lib/python2.7/site-packages/django/__init__.py", line 21, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/ubunt/Desktop/myproject/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/home/ubunt/Desktop/myproject/local/lib/python2.7/site-packages/django/apps/config.py", line 87, in create
    module = import_module(entry)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named auth

2 个答案:

答案 0 :(得分:0)

实际上当我在django项目中创建自定义登录页面时出现此错误..假设您创建了一个调用auth的应用程序,但由于某种原因您从项目中删除了此应用程序但未卸载('auth',)来自project setting.py。

所以如果将来你得到这样的错误,那么它也是删除'auth'的问题之一,也来自项目setting.py

答案 1 :(得分:0)

存在导入错误没有模块名称auth,您在项目中的某处导入。

在您的追溯中,最后提到它:

File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/ubunt/Desktop/myproject/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/home/ubunt/Desktop/myproject/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute
    django.setup()
  File "/home/ubunt/Desktop/myproject/local/lib/python2.7/site-packages/django/__init__.py", line 21, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/ubunt/Desktop/myproject/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/home/ubunt/Desktop/myproject/local/lib/python2.7/site-packages/django/apps/config.py", line 87, in create
    module = import_module(entry)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named auth

最后一行:

ImportError:没有名为auth的模块