2013-06-26 2 views
1

django 1.5.1을 사용하고 있으며 관리 명령을 이동하려고합니다. 나는 환자라는 응용 프로그램을 가지고 여기 디렉토리 구조입니다. 여기django에서 관리 명령을 찾을 수 없습니다.

patient/ 
├── __init__.py 
├── forms.py 
├── management 
│   ├── __init.py__ 
│   └── commands 
│    ├── __init.py__ 
│    └── recall1.py 
├── models.py 
├── urls.py 
├── views.py 

내가 recall1 명령을 실행하려고 할 때 발생하는 것입니다 : 여기

$ python manage.py recall1 
Unknown command: 'recall1' 

을처럼 내 코드는 모양을 : 잘못된 일을

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) 

내가 전에 수정해야 나는이 일을 할 수 있니? 응용 프로그램은

답변

3

귀하의 파일 이름 __init.py__ 실제로 디렉토리 management/commands/

+0

뜨아에서 __init__.py 모두해야한다 ..이 문제를 제외하고, 좋은 실행됩니다. 내가 이것을 놓쳤다는 것을 믿을 수 없다. 감사. – Trewq

+0

너트 ... 나는 같은 문제가 있지만 그 특별한 실수를 저지른 건 아니었다. :) – offby1