Remove create superuser management command

As we now have the first time setup page this isn't necessary anymore
This commit is contained in:
Frank Hamand 2017-03-08 11:52:59 +00:00
parent 3c288baf1e
commit c741b9765b
5 changed files with 2 additions and 26 deletions

View File

@ -14,9 +14,9 @@ script:
- tox
- docker-compose -f docker-compose-test.yml run --rm test bash bin/test_with_coverage -v2
- git checkout $(git describe --abbrev=0 --tags `git describe --abbrev=0 --tags`^)
- docker-compose run --rm -e CABOT_SUPERUSER_USERNAME='admin' -e CABOT_SUPERUSER_PASSWORD='pass' web true
- docker-compose run --rm web true
- git checkout -
- docker-compose run --rm -e CABOT_SUPERUSER_USERNAME='admin' -e CABOT_SUPERUSER_PASSWORD='pass' web true
- docker-compose run --rm web true
after_success:
- pip install codecov

View File

@ -2,5 +2,4 @@
set -e
python manage.py syncdb --noinput
python manage.py collectstatic --noinput
python manage.py create_cabot_superuser
# python manage.py compress

View File

@ -1,23 +0,0 @@
import os
from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand
from django.db import IntegrityError
class Command(BaseCommand):
def handle(self, *args, **options):
username = os.environ.get('CABOT_SUPERUSER_USERNAME')
if username:
try:
get_user_model().objects.create_superuser(
username=username,
email=os.environ.get('CABOT_SUPERUSER_EMAIL'),
password=os.environ.get('CABOT_SUPERUSER_PASSWORD')
)
print('Created superuser "{}"'.format(username))
except IntegrityError:
print('Superuser "{}" already exists'.format(username))
else:
print('CABOT_SUPERUSER_USERNAME environment variable not found, not creating superuser')