Skip to content

eproba/testing-docker-docs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Epróba - testowanie lokalnie

  1. Pobierz i zainstaluj Docker Desktop

  2. Po restarcie uruchom Docker Desktop Screenshot 2024-09-25 111836

  3. Wyszukaj "eproba" i kliknij Run przy antonicz/eproba Screenshot 2024-09-25 111849

  4. Po pobraniu wyskoczy okienko, kliknij na nim Optional settings Screenshot 2024-09-25 112135

  5. Wpisz 8000 w pierwszym polu w Ports i naciśnij Run Screenshot 2024-09-25 112158

  6. Kliknij w zakładkę Exec Screenshot 2024-09-25 112233

  7. Pojawi się konsola jak na zdjęciu poniżej, kliknij na nią żeby kursor zaczął migać Screenshot 2024-09-25 112550

  8. Skopiuj i wklej poniższą komendę i naciśnij Enter. Aby wkleić użyj Ctrl + Shift + V

python manage.py shell --command="
from apps.users.models import User; 
from apps.teams.models import Team, District, Patrol; 
from django.core.management import call_command; 
import random;

# Load initial district data
call_command('loaddata', 'districts_default.json')

# Create teams and patrols for each district
[district.team_set.create(name=f'Drużyna 1 {district.name}', short_name=f'd1{district.name}').patrol_set.create(name='Zastęp 1') for district in District.objects.all()]

# Fetch all patrols
patrols = list(Patrol.objects.all())

# Function to assign a random patrol
def random_patrol():
    return random.choice(patrols) if patrols else None

# Create a superuser
superuser = User.objects.create(
    email='[email protected]', 
    email_verified=True,
    patrol=random_patrol(),
    is_superuser=True,
    is_staff=True
)
superuser.set_password('superpassword123')

# Create a team leader
team_leader = User.objects.create(
    email='[email protected]', 
    email_verified=True,
    patrol=random_patrol(), 
    function=4
)
team_leader.set_password('leaderpassword123')

# Create a normal user
normal_user = User.objects.create(
    email='[email protected]', 
    email_verified=True,
    patrol=random_patrol()
)
normal_user.set_password('userpassword123')

# Save the users
superuser.save()
team_leader.save()
normal_user.save()

print('Dane początkowe zostały zaimportowane, możesz się teraz zalogować')
"

Screenshot 2024-09-25 124419

  1. Gotowe! Możesz teraz używać Epróby wchodząc na http://localhost:8000, API można testować wchodząc na http://localhost:8000/api/schema/swagger-ui/ lub http://localhost:8000/api/

Dane logowania:
Admin: [email protected] / superpassword123
Drużynowy: [email protected] / leaderpassword123
Zwykły użyrkownik: [email protected] / userpassword123

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published