How do I create a superuser account in Django 1.9.6

前端 未结 7 2083
广开言路
广开言路 2021-02-05 02:18

I am reading a book (\"Learning Django Web Development\" by Sanjeev Jaiswal and Ratan Kumar) on Django, but the book is based on an earlier version of Django (prior to version 1

7条回答
  •  终归单人心
    2021-02-05 02:54

    For Django 2

    User.objects.create_superuser(username='name',email='email',password='password')
    

    From the docs

    create_superuser(username, email, password, **extra_fields)

    Same as create_user(), but sets is_staff and is_superuser to True.

    Which can be embedded in a script, called from a command line or triggered via an API

提交回复
热议问题