J'utilise django 1.5.1 et j'essaie de déplacer la commande de gestion. J'ai une application appelée patient et voici la structure du répertoire.django ne trouve pas la commande de gestion
patient/
├── __init__.py
├── forms.py
├── management
│ ├── __init.py__
│ └── commands
│ ├── __init.py__
│ └── recall1.py
├── models.py
├── urls.py
├── views.py
Voici ce qui se passe lorsque je tente d'exécuter la commande recall1:
$ python manage.py recall1
Unknown command: 'recall1'
Voici comment mon code ressemble à:
from django.core.management.base import BaseCommand, CommandError
from recall.model import PatientRecalls, RecallType, RecallMessage
from patient.model import Patient
class Command(BaseCommand):
args = '<patient_id patient_id ...>'
def handle(self, *args, **options):
for patient_id in args:
try:
patient = Patient.objects.get(pk=int(patient_id))
except Patient.DoesNotExist:
raise CommandError('Patient "%s" does not exist' % patient_id)
patient.opened = False
patient.save()
self.stdout.write('Successfully closed patient "%s"' % patient_id)
Quel mal ai-je besoin de corriger avant Je peux courir cette chose? L'application est en cours d'exécution grande, sauf pour ce problème ..
Duh. Je ne peux pas croire que j'ai manqué ça. Merci. – Trewq
Noix ... J'ai le même problème, mais je n'ai pas fait cette erreur particulière :) – offby1