test
This commit is contained in:
parent
454dca8c9c
commit
b40e51e557
@ -1,38 +0,0 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.contrib.auth.models import User
|
||||
from decouple import config
|
||||
import sys
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Create admin user from environment variables'
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument(
|
||||
'--force',
|
||||
action='store_true',
|
||||
help='Create admin user even if one already exists',
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
# Get credentials from environment variables
|
||||
username = config('ADMIN_USERNAME', default='admin')
|
||||
password = config('ADMIN_PASSWORD', default='admin123')
|
||||
email = config('ADMIN_EMAIL', default='admin@boulangerie.fr')
|
||||
|
||||
# Check if admin user already exists
|
||||
if User.objects.filter(username=username).exists() and not options['force']:
|
||||
self.stdout.write(
|
||||
self.style.WARNING(f'Admin user "{username}" already exists')
|
||||
)
|
||||
return
|
||||
|
||||
# Create the admin user
|
||||
user = User.objects.create_superuser(
|
||||
username=username,
|
||||
email=email,
|
||||
password=password
|
||||
)
|
||||
|
||||
self.stdout.write(
|
||||
self.style.SUCCESS(f'Successfully created admin user "{username}"')
|
||||
)
|
||||
@ -2,7 +2,7 @@ import axios from 'axios';
|
||||
|
||||
// Utiliser l'URL correcte pour le backend
|
||||
const api = axios.create({
|
||||
baseURL: 'http://localhost:8000/api',
|
||||
baseURL: 'http://localhost:1029/api',
|
||||
});
|
||||
|
||||
// Ajouter un intercepteur pour gérer les erreurs de réseau
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user