Django 1.9 can not find newapp

后端 未结 2 2027
轮回少年
轮回少年 2021-01-28 02:09

I have worked with django 1.7 and recently started new project with django 1.9. The major difference with starting a new app was that new app is created with apps.py file. I rea

相关标签:
2条回答
  • 2021-01-28 02:41

    If your app is inside the "myapps" directory, you still need to include that in the path: "myapps.newapp.apps.NewAppConfig".

    0 讨论(0)
  • 2021-01-28 02:42

    If your apps directory is in the myapps directory, then check the following:

    1. Your myapps directory should have an __init__.py

    2. Include myapps in the path when you include the app in INSTALLED_APPS, i.e. 'myapps.newapp.apps.NewAppConfig',

    3. Include myapps in the app config's name attribute:

      class NewAppConfig(AppConfig):
          name = 'myapps.newapp'
      
    0 讨论(0)
提交回复
热议问题