I tries to do this tutorial, but I have one problem. It is caused another version Django. I have seen many similar topics on the forum but I was not able match them to my situation.
When trying to start 'http://127.0.0.1:8000/accounts/login/' in files like those below, I can see the message 'NoReverseMatch at /accounts/login/'.
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/accounts/login/
Django Version: 2.0.7
Python Version: 3.7.0
Installed Applications:
('django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'bootstrap3',
 'reviews')
Installed Middleware:
[]
Template error:
In template C:\Users\tymot\Desktop\aktualny_projekt-Podejscie_2\env\my_app\winerama\templates\base.html, error at line 21
   'auth' is not a registered namespace
   11 :         </div>
   12 :         <div id="navbar" class="navbar-collapse collapse">
   13 :             <ul class="nav navbar-nav">
   14 :                 <li><a href="{% url 'reviews:wine_list' %}">Wine list</a></li>
   15 :                 <li><a href="{% url 'reviews:review_list' %}">Home</a></li>
   16 :             </ul>
   17 :             <ul class="nav navbar-nav navbar-right">
   18 :             {% if user.is_authenticated %}
   19 :                 <li><a href="{% url 'auth:logout' %}">Logout</a></li>
   20 :                 {% else %}
   21 :                 <li><a href=" {% url 'auth:login' %} ">Login</a></li>
   22 :                 {% endif %}
   23 :             </ul>
   24 :         </div>
   25 :     </nav>
   26 :     
   27 : 
   28 :     <h1>{% block title %}(no title){% endblock %}</h1>
   29 : 
   30 :     {% bootstrap_messages %}
   31 : 
Traceback:
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\urls\base.py" in reverse
  75.                 extra, resolver = resolver.namespace_dict[ns]
During handling of the above exception ('auth'), another exception occurred:
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\handlers\exception.py" in inner
  35.             response = get_response(request)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\handlers\base.py" in _get_response
  158.                 response = self.process_exception_by_middleware(e, request)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\handlers\base.py" in _get_response
  156.                 response = response.render()
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\response.py" in render
  106.             self.content = self.rendered_content
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\response.py" in rendered_content
  83.         content = template.render(context, self._request)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\backends\django.py" in render
  61.             return self.template.render(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render
  175.                     return self._render(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in _render
  167.         return self.nodelist.render(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render
  943.                 bit = node.render_annotated(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render_annotated
  910.             return self.render(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\loader_tags.py" in render
  155.             return compiled_parent._render(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in _render
  167.         return self.nodelist.render(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render
  943.                 bit = node.render_annotated(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render_annotated
  910.             return self.render(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\loader_tags.py" in render
  67.                 result = block.nodelist.render(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render
  943.                 bit = node.render_annotated(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render_annotated
  910.             return self.render(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\defaulttags.py" in render
  314.                 return nodelist.render(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render
  943.                 bit = node.render_annotated(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render_annotated
  910.             return self.render(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\defaulttags.py" in render
  447.             url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\urls\base.py" in reverse
  86.                     raise NoReverseMatch("%s is not a registered namespace" % key)
Exception Type: NoReverseMatch at /accounts/login/
Exception Value: 'auth' is not a registered namespace
My urls.py:
urlpatterns = [
    path('reviews/', include('reviews.urls', namespace="reviews")),
    path('admin/', admin.site.urls),
    path('accounts/', include('django.contrib.auth.urls',)) 
]
My settings.py:
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = ')g@^(l6+_uc*ckf%rj2i+89v^4^r3k!$l76husfgc74nk1#&g+'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'bootstrap3',
    'reviews',
)
MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'django.middleware.security.SecurityMiddleware',
)
ROOT_URLCONF = 'winerama.urls'
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
        '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',
            ],
        },
    },
]
WSGI_APPLICATION = 'winerama.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}
# Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/
STATIC_URL = '/static/'
My directory:
-templates
--base.html
--registration
---logged_out.html
---login.html
-winerama
--__init__.py
--settings.py
--urls.py
--wsgi
-reviews(all files from applications that work well)
Then I tried change my code in urls.py on:
from django.contrib import admin
from django.urls import path, include
app_name = 'auth'
urlpatterns = [
    path('reviews/', include('reviews.urls', namespace="reviews")),
    path('admin/', admin.site.urls),
    path('accounts/', include('django.contrib.auth.urls', namespace='auth'))
]
But CMD returns a message:
'Specifying a namespace in include() without providing an app_name '
I tried to change the code in login.html and urls.py but it also does not work good.
'<li><a href="{% url 'login' %}">Login</a></li>' (login file)
'path('accounts/', include('django.contrib.auth.urls', namespace=auth))' (urls file)
I think the error is caused the name of the application ('app_name = 'auth'). How i to give them the correct name(if my html files are not in the middle of any application)? Or how can I solve my mistake?
EDIT (THE NEXT TEST 1)
Well, below I wrote my steps:
1.) In my base.html I changed this:
<li><a href="{% url 'logout' %}">Logout</a></li>
and this:
<li><a href="{% url 'login' %}">Login</a></li>
2.) I'm going to my server, using the http://127.0.0.1:8000/accounts/login/
3.)He returns me information:
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/accounts/login/
Django Version: 2.0.7
Python Version: 3.7.0
Installed Applications:
('django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'bootstrap3',
 'reviews')
Installed Middleware:
[]
Template error:
In template C:\Users\tymot\Desktop\aktualny_projekt-Podejscie_2\env\my_app\winerama\templates\base.html, error at line 8
   'auth' is not a registered namespace
   1 : {% load bootstrap3 %}
   2 : 
   3 : {% bootstrap_css %}
   4 : {% bootstrap_javascript %}
   5 : 
   6 : {% block bootstrap3_content %}
   7 : <div class="container">
   8 :     <na v class="navbar navbar -default">
   9 :         <div class="navbar-header">
   10 :             <a class="navbar-brand" href="{% url 'reviews:review_list' %}">Winerama</a>
   11 :         </div>
   12 :         <div id="navbar" class="navbar-collapse collapse">
   13 :             <ul class="nav navbar-nav">
   14 :                 <li><a href="{% url 'reviews:wine_list' %}">Wine list</a></li>
   15 :                 <li><a href="{% url 'reviews:review_list' %}">Home</a></li>
   16 :             </ul>
   17 :             <ul class="nav navbar-nav navbar-right">
   18 :             {% if user.is_authenticated %}
Traceback:
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\urls\base.py" in reverse
  75.                 extra, resolver = resolver.namespace_dict[ns]
During handling of the above exception ('auth'), another exception occurred:
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\handlers\exception.py" in inner
  35.             response = get_response(request)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\handlers\base.py" in _get_response
  158.                 response = self.process_exception_by_middleware(e, request)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\handlers\base.py" in _get_response
  156.                 response = response.render()
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\response.py" in render
  106.             self.content = self.rendered_content
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\response.py" in rendered_content
  83.         content = template.render(context, self._request)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\backends\django.py" in render
  61.             return self.template.render(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render
  175.                     return self._render(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in _render
  167.         return self.nodelist.render(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render
  943.                 bit = node.render_annotated(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render_annotated
  910.             return self.render(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\loader_tags.py" in render
  155.             return compiled_parent._render(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in _render
  167.         return self.nodelist.render(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render
  943.                 bit = node.render_annotated(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render_annotated
  910.             return self.render(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\loader_tags.py" in render
  67.                 result = block.nodelist.render(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render
  943.                 bit = node.render_annotated(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render_annotated
  910.             return self.render(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\loader_tags.py" in render
  67.                 result = block.nodelist.render(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render
  943.                 bit = node.render_annotated(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render_annotated
  910.             return self.render(context)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\defaulttags.py" in render
  447.             url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)
File "C:\Users\tymot\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\urls\base.py" in reverse
  86.                     raise NoReverseMatch("%s is not a registered namespace" % key)
Exception Type: NoReverseMatch at /accounts/login/
Exception Value: 'auth' is not a registered namespace
EDIT (THE NEXT TEST 2)
Well, if shows me an error ('auth' is not a registered) after changes in html i try to add 'namespace='auth''.
1.1)I'm changing my urls.py file form this:
urlpatterns = [
...
    path(r'accounts/', include('django.contrib.auth.urls'))
]
to this:
urlpatterns = [
...
    path(r'accounts/', include('django.contrib.auth.urls', namespace='auth' ))
]
1.2)Trying to start the server and CMD(Command Line) returns information
'Specifying a namespace in include() without providing an app_name '.
1.3) Well i try add app_name:
app_name='django.contrib.auth' #or only 'auth'
urlpatterns = [
...
    path(r'accounts/', include('django.contrib.auth.urls', ))
]
1.4) She still returns 'Specifying a namespace in include() without providing an app_name '. And here I do not know what to do.
