私はdjango 1.5.1を使用しており、管理コマンドを動かそうとしています。私は患者と呼ばれるアプリを持っており、これがディレクトリ構造です。
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)
このことを実行する前に、どのような問題を修正する必要がありますか? この問題を除いて、アプリはうまく動作しています..