Total Django Newbie here,
I am using Django CMS, which has a very quiet community, to set up a Django site that needs a login page for its users.
I have tried to use. I have found numerous tutorials, many of which are pre-3.0, and in referencing Django’s documentation on setting up a Template with the Django default login forms. I have a login.html that can be used without any errors, but the table meant to show the login forms is empty making logging in not possible (the button appears):
<form method="post" action="{% url 'login' %}"> {% csrf_token %} <table> <tr> <td>{{ form.username.label_tag }}</td> <td>{{ form.username }}</td> </tr> <tr> <td>{{ form.password.label_tag }}</td> <td>{{ form.password }}</td> </tr> </table>
I am probably missing something really simple here. The urls.py appears to be set correctly with no errors:
-- coding: utf-8 --
from future import absolute_import, print_function, unicode_literals
from cms.sitemaps import CMSSitemap
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from django.contrib.sitemaps.views import sitemap
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.views.static import serve
from django.contrib.auth import views as auth_views
from django.urls import path, include #From https://wsvincent.com/django-user-authentication-tutorial-login-and-logout/admin.autodiscover()
urlpatterns = [
url(r’^sitemap.xml$', sitemap,
{‘sitemaps’: {‘cmspages’: CMSSitemap}}),
]urlpatterns = [
url(‘admin/’, admin.site.urls),
url(‘accounts/’, include(‘django.contrib.auth.urls’)),
url(r’^', include(‘cms.urls’)), #This is added seperately
]
Its my understanding that the Auth Forms don’t need to be imported deliberately and are part of the default Django install.
Hopefully someone can point out a simple mistake.