Reset password in Django

I have this tutorial https://www.youtube.com/watch?v=z6pXNf2SzQQ that explains how to send mail to the reset password, I follow all the steps, but I always have the same error: there is no module named ' my_app.views.django '; 'my_app.views' is not a package. For this case, my_app = melomanos. I have all the templates for the Django reset password in the site templates folder.

Full root of the site:

root of my app

The error that appears is: I know that I have monetized URLs, but I don’t understand how I can configure it correctly. Thank you for your cooperation.

ImportError at /resetpassword/
No module named 'melomanos.views.django'; 'melomanos.views' is not a package
Request Method: GET
Request URL:    http://localhost/resetpassword/
Django Version: 1.8.2
Exception Type: ImportError
Exception Value:    
No module named 'melomanos.views.django'; 'melomanos.views' is not a package
Exception Location: C:\Python34\lib\importlib\__init__.py in import_module, line 109
Python Executable:  C:\Python34\python.exe
Python Version: 3.4.3
Python Path:['c:\\labsoft',
'C:\\Python34\\lib\\site-packages\\psycopg2-2.6-py3.4-win-amd64.egg',
'C:\\Windows\\SYSTEM32\\python34.zip',
'C:\\Python34\\DLLs',
'C:\\Python34\\lib',
'C:\\Python34',
'C:\\Python34\\lib\\site-packages',
'labsoft/melomanos',
'/melomanos']

here are the codes:

melomanos \ urls.py

from django.conf.urls import patterns, url, include
from django.views.generic.base import TemplateView
from django.contrib import admin
from .views import Buscar_view
admin.autodiscover()

urlpatterns = patterns('melomanos.views',
                   url(r'^admin/', include(admin.site.urls)),
                   url(r'^$','trabajos_all_view',name='url_index'),
                   url(r'^register/$','register_view',name='vista_registro'),
                   url(r'^login/$','login_view',name='vista_login'),
                   url(r'^logout/$','logout_view',name='vista_logout'),
                   url(r'^perfil/$','registro_view',name='vista_perfil'),
                   url(r'^publicar/$','trabajomusical_view', name='vista_publicar'),
                   url(r'^trabajos/$','trabajos_view',name='vista_trabajos'),
                   url(r'^trabajo/(?P<id_trabajo>.*)/$','solo_trabajo_view', name='vista_trabajo'),
                   url(r'^buscar/$',Buscar_view.as_view(),name='vista_buscar'),
                   url('', include('django.contrib.auth.urls')),
                   url(r'^resetpassword/passwordsent/$', 'django.contrib.auth.views.password_reset_done', name='password_reset_done'),
                   url(r'^resetpassword/$', 'django.contrib.auth.views.password_reset', name="reset_password"),
                   url(r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>,+)/$', 'django.contrib.auth.views.password_reset_confirm'),
                   url(r'^reset/done/$', 'django.contrib.auth.views.password_reset_complete'),
                   )

Link on the login page:

<p>Forgot your password?<a href="/resetpassword/">Reset Password</a></p>

settings.py

    INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'melomanos',
    )
+4
source share
2 answers

melomanos\urls.py url.

urlpatterns = patterns('melomanos.views',
    url(r'^resetpassword/$', 'django.contrib.auth.views.password_reset', name="reset_password"),
)

/resetpassword/ melomanos.views.django.contrib.auth.views.password_reset django.contrib.auth.views.password_reset

reset .

resetpassword , ,

urlpatterns += patterns('',
    url(r'^resetpassword/$', 'django.contrib.auth.views.password_reset', name="reset_password"),
)
+4

TL; DR; - - . prefix.

:

- Django url, , . , Django prefix django.conf.urls.patterns(), .

.

urls.py . prefix.

, Django 1.8 patterns Django 2.0:

def patterns(prefix, *args):
    warnings.warn(
        'django.conf.urls.patterns() is deprecated and will be removed in '
        'Django 2.0. Update your urlpatterns to be a list of '
        'django.conf.urls.url() instances instead.',
        RemovedInDjango20Warning, stacklevel=2
    )
    # Implementation

(docs):

from django.conf.urls import url
from myapp import views

urlpatterns = [
    url('^$', views.myview),
    url('^other/$', views.otherview),
]
+4

All Articles