diff --git a/Dockerfile b/Dockerfile index bec048e..ff4ccaa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,4 +13,4 @@ ADD requirements.txt /site/ RUN pip install -U -r /site/requirements.txt COPY ./ /site -CMD bash -c 'python3 manage.py migrate --noinput && python3 manage.py collectstatic --noinput && uwsgi --ini=/site/uwsgi.ini' \ No newline at end of file +CMD bash -c 'python3 manage.py migrate --noinput && python3 manage.py collectstatic --noinput && python3 manage.py create_test_users && uwsgi --ini=/site/uwsgi.ini' diff --git a/README.md b/README.md index 5a9702b..13e097f 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ docker build -t ipv6dotwork . -docker run -d -p 127.0.0.1:8001:8000 --name ipv6dotwork ipv6dotwork +sudo docker rm -f ipv6dotwork + +sudo docker run -d -p 127.0.0.1:8001:8000 --env-file .env --name ipv6dotwork ipv6dotwork \ No newline at end of file diff --git a/jobs/management/__init__.py b/jobs/management/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/jobs/management/commands/__init__.py b/jobs/management/commands/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/jobs/management/commands/create_test_users.py b/jobs/management/commands/create_test_users.py new file mode 100644 index 0000000..fb5212e --- /dev/null +++ b/jobs/management/commands/create_test_users.py @@ -0,0 +1,25 @@ +from django.core.management import BaseCommand +from django.contrib.auth import get_user_model + +User = get_user_model() + + +class Command(BaseCommand): + help = "Create test accounts. Don't use this in production!" + + def handle(self, *args, **options): + user_fixture = [ + { + 'username': 'user1', + 'email': 'user1@dev.ipv6.work', + 'password': 'user1' + }, + { + 'username': 'user2', + 'email': 'user2@dev.ipv6.work', + 'password': 'user2' + }, + ] + + for user_data in user_fixture: + User.objects.create_user(**user_data)