Please sign in to comment.
Create Django Superuser
Since the ``syncdb`` command was run non-interactively, it did not prompt us to create a superuser, and therefore, we don't have a user to login. To create an admin user automatically, we will write a simple Python script that will use Django's environment, load the authentication models, create a ``User`` object, set a password, and give him superuser privileges. The user login will be ``admin``, and its password will be ``password``. Note that if the user already exists, it won't be touched. However, if it does not exist, it will be re-created. If you don't like this ``admin`` user, you should not delete it (it would be re-added each time you push your code) but just remove its privileges and reset its password, for instance. .. At this point, if we push the code, we will be able to login, but we still lack the CSS that will make the admin site look nicer.
- Loading branch information...
|@@ -0,0 +1,9 @@|
|+from wsgi import *|
|+from django.contrib.auth.models import User|
|+u, created = User.objects.get_or_create(username='admin')|
|+ u.is_superuser = True|
|+ u.is_staff = True|