The Django1.11 framework of Python3.6 is replacing the auth_user error report problem record

     When using Django to develop a project, Django will have its own auth_user table, but this table usually cannot meet the needs of our project development, then we need to replace it and regenerate the user table we need. However, when replacing, the following error may be reported:


django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency users.0001_initial on database 'default'.

        This error is because the makemigrations and migrate of the project have been executed before. The solution to this problem is as follows:

        1. First delete the migrations folder:

  

        2. Then comment out django.contrib.admin in the INSTALLED_APPS configuration item in settings.py, and add the users configuration. As shown in the figure:


        3. Execute makemigrations users and migrate users to regenerate to replace auth_user, as shown in the figure:


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324422074&siteId=291194637