2013-01-15 179 views
1

我試圖使用Django模板,但即使想我已經使用PIP安裝,當我寫下這個:錯誤Django模板

from django.templated_email import send_templated_mail 

我得到這個錯誤(我想用這個模板:https://github.com/bradwhittington/django-templated-email):

ImportError at/
No module named templated_email 
Request Method: GET 
Request URL: http://127.0.0.1:8000/ 
Django Version: 1.4 
Exception Type: ImportError 
Exception Value: No module named templated_email 
Exception Location: /Users/user/folder/MyProyect/proyect/templated_email/send_email.py in <module>, line 26 
Python Executable: /usr/bin/python 
Python Version: 2.7.1 
Python Path: ['/Users/user/folder/MyProyect/proyect', 
    '/Library/Python/2.7/site-packages/pip-1.0-py2.7.egg', 
    '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', 
    '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', 
    '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', 
    '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', 
    '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', 
    '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', 
    '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', 
    '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', 
    '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', 
    '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', 
    '/Library/Python/2.7/site-packages', 
    '/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg-info'] 
Server time: mar, 15 Ene 2013 12:04:27 +0100 

如果有人知道如何解決這個問題,請告訴我如何(如果有一個例子將是偉大的)

非常感謝

回答

1

的問題是,在說明它不說,你需要在設置中添加。 PY,在INSTALLED_APPS「templated_email」

1

從該行刪除django.

from django.templated_email import send_templated_mail 
+0

當我做到這一點,我得到 導入錯誤在/ 不能導入名稱send_templated_mail,我得到無法導入名稱,而擁有它,我得到無法導入模塊 – Sascuash

+0

如果您需要更多的代碼,只需要它 – Sascuash

+0

請確保您將它安裝在正在使用的正確環境中(如果您使用的是virtualenv)。否則,請停止並重新啓動服務器。 –

0

你應該導入這樣from templated_email import send_templated_mail代替from django.templated_email import send_templated_mail