Heroku - heroku run python manage.py migrate error

0

I'm trying to migrate through heroku to log in with fb but when I run the command heroku run python manage.py migrate the following happens (I'm supposed to have already done diployed in heroku):

>>> heroku run python manage.py migrate
Running python manage.py migrate on ⬢ afternoon-lake-17482... up, run.2063 (Free)
/app/.heroku/python/lib/python3.6/site-packages/six.py:808: RemovedInDjango110Warning: SubfieldBase has been deprecated. Use Field.from_db_value instead.
    return meta(name, bases, d)

SystemCheckError: System check identified some issues:

ERRORS:
default.UserSocialAuth.user: (fields.E304) Reverse accessor for 'UserSocialAuth.user' clashes with reverse accessor for 'UserSocialAuth.user.
    HINT: Add or change a related_name argument to the definition for UserSocialAuth.user' or 'UserSocialAuth.user.
default.UserSocialAuth.user: (fields.E305) Reverse query name for 'UserSocialAuth.user' clashes with reverse query name for 'UserSocialAuth.user'.
    HINT: Add or change a related_name argument to the definition for 'UserSocialAuth.user' or 'UserSocialAuth.user'.

Please, do you have any idea what I can do? I just started in the world of django.

    
asked by Metalsneak 01.05.2017 в 04:15
source

1 answer

1

It does not seem to be Heroku's own error, but in any attempt to put your code to work on another computer, those errors will be skipped.

Apparently you have a problem with the definition of a model, specifically one that has 2 references (ForeignKey) to the UserSocialAuth.user model. Why is a problem created in a situation like this? Let's see the following example:

class Clase1(models.Model): descripcion = models.CharField(max_length=80) u_creador = models.ForeignKey(Usuario) u_modificador = models.ForeignKey(Usuario)

here, in addition, from the relation from Class1 to User, a relation is automatically created from User to Class1, this relation could be used to answer the question: which objects of Class1 are related to user X ?; Now, this question raises a question, should we consider only the objects created by user X, only those modified or both? In addition, we must clarify that this relationship is generated automatically, assigning a name composed of the names of both classes (let's say it is called usuario_clase1 ), and that is where the error for Django is generated, because it can not use the same name for the User reference with the u_creater field and for the User reference with the u_modifier field.

Before this problem there are 2 possible solutions: specify a particular name, to solve the problem of Django; or indicate that the creation of that opposite reference is not required, from User to Class1. In both cases, the related_name argument must be used for the ForeignKey field, as mentioned in the documentation .

    
answered by 01.05.2017 в 17:54