2012-04-25 4 views
2

나는 장고 등록 코드를 편집하지 않고 HTML에서 활성화 이메일을 가지고 사용자 정의 백엔드를 만들어장고 등록 : 맞춤 백엔드를 포함하는 방법?

(REF. django+ send email in html with django-registration, 최종 해답)

이 저장됩니다 DefaultBackend처럼 core/registration/backends/htmldefault/__init__.py에 저장 백엔드이며, registration/backends/__init__.py

from registration.forms import RegistrationForm 
from core.models import HtmlRegistrationProfile 

class HtmlDefaultBackend(object): 
    #etc same as DefaultBackend but using HtmlRegistrationProfile instead of RegistrationProfile 

이 내 urls.py입니다

urlpatterns = patterns('', 
    #... 
    url(r'^accounts/register/$', register, {'backend': 'core.registration.backends.htmldefault.HtmlDefaultBackend','form_class': UserRegistrationForm}, name='registration_register'), 
    url(r'^accounts/', include('registration.urls')), 
    #... 
) 

하지만 /registration/backends/__init__.py in get_backend, line 27

에 의해 슬로우

ImproperlyConfigured at /accounts/register/ 

Error loading registration backend core.registration.backends.htmldefault: "No module named registration.backends.htmldefault" 

를 얻을 내가 뭘 부탁 해요하면 등록 패키지 외부에있는 사용자 정의 장고 등록 백엔드를 가지고 .. 가능이된다? 또는/등록/백엔드/간단한 백엔드 기본 백엔드처럼 살 수 있어야합니까?

답변

2

가능합니다.

  1. 확인 모든 폴더 (코어, 등록, 백엔드, htmldefault가) __init__.py이있는 경우 (비어있을 수 있습니다.)

  2. 코어 폴더가 프로젝트 디렉토리에 있습니까?

+1

이 바보 같은 오류가 .. 먼저 포인트 1, 난 모든 폴더에있는 __init__.py (즉 아주 나쁜 미스이었다) 등록 패키지와, 그 경로 생성 충돌을 생성하지 않았다 ... 지금은 모든 것이있다 일하고있어, 고마워. – apelliciari