2017-02-17 2 views
1

Ich bin fast in das Handtuch werfen mit überschreiben der Vorlage. So funktioniert es nicht für mich. Immer es sieht die Vorlage im Standardverzeichnis:Override Vorlage django-allaut

/Library/Python/2.7/site-packages/allauth/templates/account 

Ich versuche haben fast alles, was ich gefunden: https://stackoverflow.com/a/18811664/3348531 https://stackoverflow.com/a/40065009/3348531

meine dir Struktur:

myproject 
    myproject 
    myapp 
     templates 
     accounts 
      login.html 
      ... 

Aber ich auch versuchen:

myproject 
    myproject 
    myapp 
     templates 
     myapp 
      accounts 
       login.html 
      ... 

Nichts Arbeit

--urls.py 

    urlpatterns = [ 
    url(r'^accounts/', include('allauth.urls')), 
    ... 


--settings.py 

INSTALLED_APPS = [ 
'formimmapp.apps.FormimmappConfig', 
'django.contrib.sites', 
'allauth', 
'allauth.account', 
'allauth.socialaccount', 
'django.contrib.admin', 
'django.contrib.auth', 
'django.contrib.contenttypes', 
'django.contrib.sessions', 
'django.contrib.messages', 
'django.contrib.staticfiles', 
'formtools', 
'crispy_forms', 
] 

TEMPLATE_DIRS = (os.path.join(PROJECT_DIR, 'templates'),) 

TEMPLATES = [ 
{ 
    'BACKEND': 'django.template.backends.django.DjangoTemplates', 
    # 'DIRS': [os.path.join(BASE_DIR,'templates')], 
    'DIRS': [os.path.join(PROJECT_DIR, 'templates')], 
    # 'DIRS': [], 
    'APP_DIRS': True, 
    'OPTIONS': { 
     'context_processors': [ 
      'django.template.context_processors.debug', 
      'django.template.context_processors.request', 
      'django.contrib.auth.context_processors.auth', 
      'django.contrib.messages.context_processors.messages', 
     ], 
    }, 
}, 

]

Django Version

1.10.1 
+0

was passiert, wenn Sie versuchen, mit 'os.path.join (BASE_DIR, 'myapp/templates', 'allauth')' ..? und dann können Sie das grundlegende Template dir von allauth folgen, ein Beispiel wie 'myapp/templates/account /', 'myapp/templates/socialaccount', oder sonst .. _ [für mehr checkout dies] (https: // github. com/pennersr/django-allauth/baum/master/allauth/templates) _ –

+0

hast du meine antwort – e4c5

Antwort

1

Ein leicht genug Fehler zu machen. Viele Menschen fügen Sie diese auf die folgende Zeile zu ihrem urls.py und denken, dass die Vorlagen in einen Ordner mit dem Namen gehen sollte

Konten
url(r'^accounts/', include('allauth.urls')), 

aber nicht, ist dies lediglich das URL-Mapping für den Login-URLs. Die App Name kommt von

'allauth', 
'allauth.account', 

in Ihrem django settings.py aber, was Sie haben, ist eine Ordnerstruktur mit Konto s

myproject 
    myproject 
    myapp 
     templates 
     myapp 
      accounts 

Umbenennungs, das Konto zu, und Sie werden fein

+0

Waoo !!! Vielen Dank @ e4c5 – Gael

+0

Ich bin froh, dass ich geholfen habe – e4c5