Bearle / django-web3-auth

A pluggable Django app that enables login/signup via an Ethereum wallet (a la CryptoKitties)
Other
88 stars 40 forks source link

Example app has missing url configuration #4

Closed miratcan closed 3 years ago

miratcan commented 3 years ago
Ekran Resmi 2021-07-11 23 27 33
Environment:

Request Method: GET
Request URL: http://localhost:8000/login/

Django Version: 2.0.6
Python Version: 3.9.6
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'web3auth']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']

Template error:
In template /private/tmp/django-web3-auth/example/templates/web3auth/base.html, error at line 46
   Reverse for 'web3auth_signup' not found. 'web3auth_signup' is not a valid view function or pattern name.
   36 : 
   37 :     <div class="collapse navbar-collapse" id="navbarSupportedContent">
   38 :       <ul class="navbar-nav mr-auto">
   39 :         <li class="nav-item">
   40 :           <a class="nav-link" href="{% url 'login' %}">Login</a>
   41 :         </li>
   42 :         <li class="nav-item">
   43 :           <a class="nav-link" href="{% url 'autologin' %}">Autologin</a>
   44 :         </li>
   45 :         <li class="nav-item">
   46 :           <a class="nav-link" href=" {% url 'web3auth_signup' %} ">Signup</a>
   47 :         </li>
   48 :       </ul>
   49 :     </div>
   50 :   </nav>
   51 : 
   52 : </div>
   53 : <div class="container">
   54 : 
   55 :   {% if messages %}
   56 :     {% for message in messages %}

Traceback:

File "/private/tmp/django-web3-auth/example/venv/lib/python3.9/site-packages/django/core/handlers/exception.py" in inner
  35.             response = get_response(request)

File "/private/tmp/django-web3-auth/example/venv/lib/python3.9/site-packages/django/core/handlers/base.py" in _get_response
  128.                 response = self.process_exception_by_middleware(e, request)

File "/private/tmp/django-web3-auth/example/venv/lib/python3.9/site-packages/django/core/handlers/base.py" in _get_response
  126.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/private/tmp/django-web3-auth/example/example/urls.py" in login
  24.         return render(request, 'web3auth/login.html')

File "/private/tmp/django-web3-auth/example/venv/lib/python3.9/site-packages/django/shortcuts.py" in render
  36.     content = loader.render_to_string(template_name, context, request, using=using)

File "/private/tmp/django-web3-auth/example/venv/lib/python3.9/site-packages/django/template/loader.py" in render_to_string
  62.     return template.render(context, request)

File "/private/tmp/django-web3-auth/example/venv/lib/python3.9/site-packages/django/template/backends/django.py" in render
  61.             return self.template.render(context)

File "/private/tmp/django-web3-auth/example/venv/lib/python3.9/site-packages/django/template/base.py" in render
  175.                     return self._render(context)

File "/private/tmp/django-web3-auth/example/venv/lib/python3.9/site-packages/django/template/base.py" in _render
  167.         return self.nodelist.render(context)

File "/private/tmp/django-web3-auth/example/venv/lib/python3.9/site-packages/django/template/base.py" in render
  943.                 bit = node.render_annotated(context)

File "/private/tmp/django-web3-auth/example/venv/lib/python3.9/site-packages/django/template/base.py" in render_annotated
  910.             return self.render(context)

File "/private/tmp/django-web3-auth/example/venv/lib/python3.9/site-packages/django/template/loader_tags.py" in render
  155.             return compiled_parent._render(context)

File "/private/tmp/django-web3-auth/example/venv/lib/python3.9/site-packages/django/template/base.py" in _render
  167.         return self.nodelist.render(context)

File "/private/tmp/django-web3-auth/example/venv/lib/python3.9/site-packages/django/template/base.py" in render
  943.                 bit = node.render_annotated(context)

File "/private/tmp/django-web3-auth/example/venv/lib/python3.9/site-packages/django/template/base.py" in render_annotated
  910.             return self.render(context)

File "/private/tmp/django-web3-auth/example/venv/lib/python3.9/site-packages/django/template/defaulttags.py" in render
  447.             url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)

File "/private/tmp/django-web3-auth/example/venv/lib/python3.9/site-packages/django/urls/base.py" in reverse
  90.     return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))

File "/private/tmp/django-web3-auth/example/venv/lib/python3.9/site-packages/django/urls/resolvers.py" in _reverse_with_prefix
  636.         raise NoReverseMatch(msg)

Exception Type: NoReverseMatch at /login/
Exception Value: Reverse for 'web3auth_signup' not found. 'web3auth_signup' is not a valid view function or pattern name.
hiporox commented 3 years ago

@miratcan URLs in Django that are sub-app need to include the app name in the URL. If you run python manage.py show_urls, you'll see that the URL registers at web3auth:web3auth_signup. Add that to the file and it will be fixed

hiporox commented 3 years ago

@delneg I think this can be closed now

delneg commented 3 years ago

Closed with #6 Thanks @hiporox