Django 1.7 conflicting models

后端 未结 2 1723
南方客
南方客 2020-12-10 10:29

I install my application in \"project/apps/myapp\" folder. Both apps and myapp folders have init.py files(Without any of them there is module missing error)

相关标签:
2条回答
  • 2020-12-10 11:04

    Instead of importing the all project then the app then the module inside the app just import the app which is inside the project then the module.

    Instead of

    from webproject.app import model
    

    Use

    from app import model
    

    or

    from app.models import Staffs
    
    0 讨论(0)
  • 2020-12-10 11:14

    I think this bug report (turns out it's a feature) is related to your problem.

    For me the problem was resolved by importing from resume.models only, rather than apps.resume.models. So search for "from apps." in your project and replace it.

    (For me, removing __init__.py or changing the PYTHONPATH caused other problems, I imagine that's common.)

    0 讨论(0)
提交回复
热议问题