A wonderful django project encountered problems

A wonderful django project encountered problems
  • django version:2.2.5
  • Symptoms
    code is written properly, a running project, reported such an error:

    error in English to the effect: RuntimeError: Model Class apps.user.models.User not declare an explicit of app_label, nor the application of the INSTALLED_APPS.
    Strange, obviously in settings.py has these app installed, why would report the problem with this wonderful?

    Before no mistake, this is to write a custom User model, a problem doing this User registration login.
    After asking, did not find the problem, it failed to solve the problem.
    Finally, inadvertently, the root of urls.py apps., are removed later, you will be able to run properly.
    These red line below apps.to delete all

    problem solving, able to run the project
  • Root of the problem
    I do not know what the root of the problem is never seen such a problem. Just guessing, perhaps the relationship between the absolute and relative paths.
    In settings.py is configured so two lines of code:

    maybe think apps.model_name.url system is an absolute path, the system can not find it. The model_name.url is a relative path, relative to the directory of the project to find app

Guess you like

Origin www.cnblogs.com/quanquan616/p/11628285.html