Django 1.9.2
Ошибка:
ViewDoesNotExist at /auth/registration/
Could not import 'loginsys.views.registration'. View does not exist in module loginsys.views.
____________________
Главный файл url.py
from django.conf.urls import include, url
from django.contrib import admin
from bakot import urls as bakot_urls
from loginsys import urls as loginsys_urls
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^', include(bakot_urls)),
url(r'^auth/', include(loginsys_urls)),
]
файл loginsys.urls.py
from django.conf.urls import include, url
from django.contrib import admin
from django.conf.urls.static import static
from django.conf import settings
from loginsys import views
urlpatterns = [
url(r'^login/', views.login, name='login'),
url(r'^logout/', views.logout, name='logout'),
url(r'^registration/', views.registration, name='registration'),
url('^', include('django.contrib.auth.urls'))
]
Вьюшка:
loginsys.views.py
from django.contrib import auth
from django.shortcuts import render, redirect, render_to_response
from django.template.context_processors import csrf
from django.contrib.auth.forms import UserCreationForm
from loginsys.models import UserCreationCustomForm
def registration(request):
args = {}
args.update(csrf(request))
args['form'] = UserCreationCustomForm()
if request.POST:
newuser_form = UserCreationCustomForm(request.POST)
if newuser_form.is_valid():
newuser_form.save()
newuser = auth.authenticate(username = newuser_form.cleaned_data['username'], password = newuser_form.cleaned_data['password2'])
auth.login(request, newuser)
return redirect('/step3')
else:
args['form'] = newuser_form
return render_to_response('registration.html', args)
На локальной машине все работает, bakot.views.py (который также в инклуде), тоже работает.
На буржуйских форумах нашел пару тем с ./manage.py shell и сделать импорт ручками, но что-то не помогает.