我正在使用Django 1.10。技术上这篇文章是关于Django-registration-redux的,但是SO不会让我创建一个新的标签来发布这个问题。 Django-registration-redux没有看到注册模板。我将所有模板复制到我的模板文件夹中名为“注册”的文件夹中。虽然我没有得到一个错误。例如,当我去/ accounts/register它呈现一些表单,但它不是我的模板/注册文件夹。林不知道我做错了什么。我甚至完全删除模板/注册文件夹,甚至没有发生错误。我阅读了一些类似的帖子,人们不得不将注册移动到已安装的应用程序的顶部,因此它不会使用我尝试过并且没有帮助的管理员表单。到目前为止没有任何改变。所有的模板都会扩展基础。Django注册Redux没有看到我的模板/注册模板
所以我猜我配置了错误的东西。有点奇怪。所有的功能都在那里,但它只是没有使用我的模板。对不起,如果它是一个愚蠢的问题,但我会感谢一些帮助!
pip freeze
Django==1.10
django-crispy-forms==1.6.0
django-registration-redux==1.4
INSTALLED_APPS = [
'registration',
'django.contrib.admin',
'django.contrib.sites',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# third party
'crispy_forms',
# my apps
'todo',
]
# Django registration redux settings
ACCOUNT_ACTIVATION_DAYS = 7
REGISTRATION_OPEN = True
REGISTRATION_AUTO_LOGIN = True
LOGIN_REDIRECT_URL = '/' # The page you want users to arrive at after they successful log in
LOGIN_URL = '/accounts/login/'
SITE_ID = 1
这里是我的/templates/registration/registration_form.html
{% extends "base.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% block content %}
<div class='row'>
<div class='col-sm-6 col-sm-offset-3'>
<h1>Register for free!</h1>
<form method="post" action=".">
{% csrf_token %}
{{ form|crispy }}
<input class='btn btn-block btn-primary' type="submit" value="{% trans 'Join' %}" />
</form>
</div>
</div>
<hr/>
<div class='row'>
<div class='col-sm-6 col-sm-offset-3 text-align-center'>
<p>Need to <a href="{% url 'auth_login' %}">Login</a>?</p>
</div>
</div>
{% endblock %}
this is a screenshot showing the form I see at accounts/register
我能够得到它的工作,但这不能是最好的方法。我进入我的virtualenv的网站包到django注册包,并找到包含它实际呈现的模板的模板文件夹。为了测试,我将实际的django注册应用程序中的模板文件夹重命名为registration_temp,并且我猜测它何时无法再找到自己的模板来强制它看到我的模板。是否有我缺少的设置,告诉django注册使用自己的模板或你的?我使用pip安装,所以我认为其他人也会遇到这个问题。 – davesharp