からDjangoテンプレートジャンゴ1.9ロード異なるアプリ
どのように私は、 "機体/ views.py" から "コントロール/テンプレート/制御/電子メール/ fuselage_job_complete" テンプレートを読み込むことができますか?
django-emailitにこのテンプレートを使用します。
私はこのようにそれを呼び出そうとしました:
emailit.api.send_mail([task.user.email], {'task': task}, 'emails/fuselage_job_complete')
私はdjango.template.exceptions.TemplateDoesNotExist
エラーを得ました。私はdjango.template.exceptions.TemplateSyntaxError: 'site' takes at least one argument (path to a view)
を得た
emailit.api.send_mail([task.user.email], {'task': task}, 'control/emails/fuselage_job_complete')
:
もこれを試してみました。
マイプロジェクト構造:
web/
├── control
│ ├── admin.py
│ ├── apps.py
│ ├── forms.py
│ ├── handlers.py
│ ├── __init__.py
│ ├── management
│ │ ├── commands
│ │ │ ├── create_researcher.py
│ │ │ ├── __init__.py
│ │ │ ├── search_alerts.py
│ │ │ ├── sync_omop_tree.py
│ │ │ └── sync_users.py
│ │ ├── __init__.py
│ ├── managers.py
│ ├── migrations
│ │ ├── __init__.py
│ ├── models.py
│ ├── signals.py
│ ├── templates
│ │ └── control
│ │ ├── emails
│ │ │ ├── fuselage_job_complete.body.html
│ │ │ ├── fuselage_job_complete.body.txt
│ │ │ ├── fuselage_job_complete.subject.txt
│ │ ├── json
│ │ │ ├── jsontree.json
│ │ │ └── omoptree.json
│ ├── templatetags
│ │ ├── controltags.py
│ │ ├── __init__.py
│ ├── tests.py
│ ├── urls.py
│ ├── user.py
│ ├── views.py
├── db.sqlite3
├── manage.py
├── static
│ ├── css
│ ├── fonts
│ ├── images
│ ├── js
│ └── resources
├── templates
│ ├── emailit
│ │ └── base_email.body.txt
│ └── registration
├── fuselage
│ ├── admin.py
│ ├── apps.py
│ ├── __init__.py
│ ├── migrations
│ │ ├── __init__.py
│ ├── models.py
│ ├── static
│ │ ├── img
│ │ │ ├── loading.gif
│ │ │ └── loading-sm.gif
│ │ └── fuselage
│ │ ├── css
│ │ └── js
│ ├── templates
│ │ └── fuselage
│ ├── tests.py
│ ├── urls.py
│ ├── views.py
└── rocket
├── __init__.py
├── settings
│ ├── base.py
│ ├── dev.py
│ ├── __init__.py
│ ├── local.py
│ ├── production.py
│ ├── test.py
├── urls.py
├── wsgi.py
マイテンプレートの設定:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'templates'),
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.request',
'absolute.context_processors.absolute',
],
},
},
]
私はあなたに「どのように2つのテンプレートを提供するか」と尋ねていますか?クイックアンサーはできません!しかし、マージすることができます... – dsgdfg
@dsgdfgこのマージを行う方法? – trex