AttributeError: 'module' object has no attribute 'tests'

后端 未结 11 1797
自闭症患者
自闭症患者 2020-12-04 14:43

I\'m running this command:

python manage.py test project.apps.app1.tests

and it causes this error:

AttributeError: \

11条回答
  •  無奈伤痛
    2020-12-04 15:35

    Make sure that all modules that you are using in your script are not broken. By this I mean check spelling in your import statements.

    # invalid import
    from app.model.notification import Notification
    # valid import
    from app.models.notification import Notification
    

    You can test yours modules by executing imports statements in djano's interactive console.

    $root@13faefes8: python manage.py shell
    Type "help", "copyright", "credits" or "license" for more information (InteractiveConsole)
    >>> from app.model.notification import Notification
    Traceback (most recent call last): 
       File "", line 1, in 
    ImportError: No module named model.notification
    

提交回复
热议问题