#Import auth views
from django.contrib.auth import views as auth_views
#Use the views in the url
path('login/', auth_views.LoginView.as_view(), name='login'),Happy coding!
On Mon, Aug 27, 2018 at 6:29 PM Tim Vogt (Tim Vogt) <timtvogt@gmail.com> wrote:
Hi Jason,Thank !my urls.py in /users looks like thisThis is the error I get with amusement.How to change the old import? I suppose this is the way. Because the admin is imported from django.
"""Defines URL patterns for users"""
from django.conf.urls import url
from . import views
# from django.contrib.auth import login
from django.contrib.auth.views import LoginView
app_name='users'
urlpatterns = [
# Login page
url('login/', LoginView, {'template_name': 'users/login.html'}, name='login'),
# Logout page
url('logout/', views.logout_view, name='logout'),
]TypeError at /users/login/
__init__() takes 1 positional argument but 2 were given
Request Method: GET Request URL: http://localhost:8000/users/login/ Django Version: 2.0.7 Exception Type: TypeError Exception Value: __init__() takes 1 positional argument but 2 were givenException Location: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/handlers/base.py in _get_response, line 126 Python Executable: /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 Python Version: 3.6.5 Python Path: ['/Users/timvogt/Software_projects/learning_log', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload', '/Users/timvogt/Library/Python/3.6/lib/python/site-packages', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages']Server time: Mon, 27 Aug 2018 15:26:32 +0000 Traceback Switch to copy-and-paste view
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/handlers/exception.py
ininner
response = get_response(request).../Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/handlers/base.py
in_get_response
response = self.process_exception_by_middleware(e, request).../Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/handlers/base.py
in_get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)...Request information
USER
AnonymousUserGET
No GET dataPOST
No POST dataFILES
No FILES dataCOOKIES
Variable Value csrftoken snipcart_order_token _xsrf username-localhost-8888 _ga pretix_csrftoken __stripe_mid Pycharm-77c83f85 META
Variable Value Apple_PubSub_Socket_Render CONTENT_LENGTH CONTENT_TYPE CSRF_COOKIE DISPLAY DJANGO_SETTINGS_MODULE GATEWAY_INTERFACE HOME HTTP_ACCEPT HTTP_ACCEPT_ENCODING HTTP_ACCEPT_LANGUAGE HTTP_CONNECTION HTTP_COOKIE HTTP_HOST HTTP_REFERER HTTP_UPGRADE_INSECURE_REQUESTS HTTP_USER_AGENT LANG LOGNAME PATH PATH_INFO PWD QUERY_STRING REMOTE_ADDR REMOTE_HOST REQUEST_METHOD RUN_MAIN SCRIPT_NAME SECURITYSESSIONID SERVER_NAME SERVER_PORT SERVER_PROTOCOL SERVER_SOFTWARE SHELL SHLVL SSH_AUTH_SOCK TERM TERM_PROGRAM TERM_PROGRAM_VERSION TERM_SESSION_ID TMPDIR TZ USER VIRTUALENVWRAPPER_HOOK_DIR VIRTUALENVWRAPPER_PROJECT_FILENAME VIRTUALENVWRAPPER_SCRIPT VIRTUALENVWRAPPER_WORKON_CD WORKON_HOME XPC_FLAGS XPC_SERVICE_NAME _ __CF_USER_TEXT_ENCODING __PYVENV_LAUNCHER__ wsgi.errors wsgi.file_wrapper wsgi.input wsgi.multiprocess wsgi.multithread wsgi.run_once wsgi.url_scheme wsgi.version Settings
Using settings module
learning_log.settings
Setting Value ABSOLUTE_URL_OVERRIDES ADMINS ALLOWED_HOSTS APPEND_SLASH AUTHENTICATION_BACKENDS AUTH_PASSWORD_VALIDATORS AUTH_USER_MODEL BASE_DIR CACHES CACHE_MIDDLEWARE_ALIAS CACHE_MIDDLEWARE_KEY_PREFIX CACHE_MIDDLEWARE_SECONDS CSRF_COOKIE_AGE CSRF_COOKIE_DOMAIN CSRF_COOKIE_HTTPONLY CSRF_COOKIE_NAME CSRF_COOKIE_PATH CSRF_COOKIE_SECURE CSRF_FAILURE_VIEW CSRF_HEADER_NAME CSRF_TRUSTED_ORIGINS CSRF_USE_SESSIONS DATABASES DATABASE_ROUTERS DATA_UPLOAD_MAX_MEMORY_SIZE DATA_UPLOAD_MAX_NUMBER_FIELDS DATETIME_FORMAT DATETIME_INPUT_FORMATS DATE_FORMAT DATE_INPUT_FORMATS DEBUG DEBUG_PROPAGATE_EXCEPTIONS DECIMAL_SEPARATOR DEFAULT_CHARSET DEFAULT_CONTENT_TYPE DEFAULT_EXCEPTION_REPORTER_FILTER DEFAULT_FILE_STORAGE DEFAULT_FROM_EMAIL DEFAULT_INDEX_TABLESPACE DEFAULT_TABLESPACE DISALLOWED_USER_AGENTS EMAIL_BACKEND EMAIL_HOST EMAIL_HOST_PASSWORD EMAIL_HOST_USER EMAIL_PORT EMAIL_SSL_CERTFILE EMAIL_SSL_KEYFILE EMAIL_SUBJECT_PREFIX EMAIL_TIMEOUT EMAIL_USE_LOCALTIME EMAIL_USE_SSL EMAIL_USE_TLS FILE_CHARSET FILE_UPLOAD_DIRECTORY_PERMISSIONS FILE_UPLOAD_HANDLERS FILE_UPLOAD_MAX_MEMORY_SIZE FILE_UPLOAD_PERMISSIONS FILE_UPLOAD_TEMP_DIR FIRST_DAY_OF_WEEK FIXTURE_DIRS FORCE_SCRIPT_NAME FORMAT_MODULE_PATH FORM_RENDERER IGNORABLE_404_URLS INSTALLED_APPS INTERNAL_IPS LANGUAGES LANGUAGES_BIDI LANGUAGE_CODE LANGUAGE_COOKIE_AGE LANGUAGE_COOKIE_DOMAIN LANGUAGE_COOKIE_NAME LANGUAGE_COOKIE_PATH LOCALE_PATHS LOGGING LOGGING_CONFIG LOGIN_REDIRECT_URL LOGIN_URL LOGOUT_REDIRECT_URL MANAGERS MEDIA_ROOT MEDIA_URL MESSAGE_STORAGE MIDDLEWARE MIGRATION_MODULES MONTH_DAY_FORMAT NUMBER_GROUPING PASSWORD_HASHERS PASSWORD_RESET_TIMEOUT_DAYS PREPEND_WWW ROOT_URLCONF SECRET_KEY SECURE_BROWSER_XSS_FILTER SECURE_CONTENT_TYPE_NOSNIFF SECURE_HSTS_INCLUDE_SUBDOMAINS SECURE_HSTS_PRELOAD SECURE_HSTS_SECONDS SECURE_PROXY_SSL_HEADER SECURE_REDIRECT_EXEMPT SECURE_SSL_HOST SECURE_SSL_REDIRECT SERVER_EMAIL SESSION_CACHE_ALIAS SESSION_COOKIE_AGE SESSION_COOKIE_DOMAIN SESSION_COOKIE_HTTPONLY
"The lion can't miss the hunt!"
https://kodenaut.github.io/
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACYP3VHqfSoxSCNk2bQ%2BKvN45sbQtP_tF0kyxU_NF-o3btjttA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment