SyntaxError: Generator expression must be parenthesized

后端 未结 8 2007
情深已故
情深已故 2020-12-29 18:52

I just installed django and after installing that I created a django project and was trying to run django server by command:

python manage.py runserver
         


        
8条回答
  •  孤城傲影
    2020-12-29 19:16

    I just faced an Error like this. I was using Django-1.11.10. I deleted it and installed Django 2.0

    Problem is solved.

    But if you are using ForeignKey in you model.py files it must be problem again. You should update your coding to 2.0 versiong insted of older versiyon.

    Example:

    django older version

    user = models.ForeignKey('auth.User', related_name='posts')
    

    django 2.0

    user = models.ForeignKey('auth.User', related_name='posts', on_delete=models.CASCADE,)
    

提交回复
热议问题