Unable to create superuser in django due to not working in TTY

前端 未结 7 1720
南方客
南方客 2021-01-12 05:40

I go through first django tutorial from djangoproject.com and at the very beginning of part 2, which is creating superuser when I run \"python manage.py createsuperuse

7条回答
  •  终归单人心
    2021-01-12 06:24

    Use this command :

    python3 manage.py makemigrations
    
    python3 manage.py migrate
    
    python3 manage.py createsuperuser
    
    python manage.py runserver
    

    Your error is probably:

    [Error `You have 14 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, content types, sessions.
    Run 'python manage.py migrate' to apply them.
    
    Traceback (most recent call last):
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/backends/utils.py", line 85, in _execute
        return self.cursor.execute(sql, params)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 303, in execute
        return Database.Cursor.execute(self, query, params)`][1]
    

    check you yo directory with Tree command:tree

    Then run Make migration : enter image description here

    then create superuser with the python3 manage.py createsuperusercommand :

提交回复
热议问题