From b9704d3cb3af20184788a6f7cb62747249e6e644 Mon Sep 17 00:00:00 2001 From: Starthur Date: Wed, 16 Feb 2022 14:13:00 +0100 Subject: [PATCH 1/2] Update README Add information about migrate and admin right on local dev --- README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f96625c..abc2332 100644 --- a/README.md +++ b/README.md @@ -28,5 +28,15 @@ DEBUG = True SECRET_KEY = 'what you want' ``` -When you'll run `python manage.py runserver`, an empty database will be automatically created. -The `local_settings.py` is in the `.gitignore` and should stay that way, so we don't accidentally overwrite the production file when we deploy. \ No newline at end of file +When you'll run `python manage.py migrate` then `python manage.py runserver`, an empty database will be automatically created. +The `local_settings.py` is in the `.gitignore` and should stay that way, so we don't accidentally overwrite the production file when we deploy. + +To obtain administrator rights you must create a user on the platform. Then you can run `python manage.py shell` and type the following commands: +``` +from django.contrib.auth.models import User +user = User.objects.get(username="") +user.is_staff = True +user.is_admin = True +user.is_superuser = True +user.save() +``` \ No newline at end of file From 28d8874272a2335d3e2a0b8774a35e3a8d8cb7a5 Mon Sep 17 00:00:00 2001 From: Starthur Date: Wed, 16 Feb 2022 14:33:21 +0100 Subject: [PATCH 2/2] Update README Better solution to create superuser admin --- README.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/README.md b/README.md index abc2332..1b2c50e 100644 --- a/README.md +++ b/README.md @@ -31,12 +31,4 @@ SECRET_KEY = 'what you want' When you'll run `python manage.py migrate` then `python manage.py runserver`, an empty database will be automatically created. The `local_settings.py` is in the `.gitignore` and should stay that way, so we don't accidentally overwrite the production file when we deploy. -To obtain administrator rights you must create a user on the platform. Then you can run `python manage.py shell` and type the following commands: -``` -from django.contrib.auth.models import User -user = User.objects.get(username="") -user.is_staff = True -user.is_admin = True -user.is_superuser = True -user.save() -``` \ No newline at end of file +To obtain administrator rights you can run `python manage.py createsuperuser`. \ No newline at end of file