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)
自己做錯了什麼,我需要糾正前我可以運行這個東西?除了此問題的應用程序正在運行偉大..
咄。不能相信我錯過了這一點。謝謝。 – Trewq
堅果...我有同樣的問題,但沒有發生這種特殊的錯誤:) – offby1