url issues

30 Aufrufe
Direkt zur ersten ungelesenen Nachricht

sum abiut

ungelesen,
25.01.2018, 20:03:0725.01.18
an django...@googlegroups.com
Hi,
i am having some issues with my url pattern. i can't seem to figure out the problem. i am running django 1.11.

i have an app name userprofile which automatically create user profiles on user creation. I have create a login template to allow users to login in before i can direct them to update their profile but i cannot seem to access the login page.

i get this below error

Inline image 1

view.py
def login(request):
    return render(request,'login.html')



urls.py
from django.conf.urls import url
from django.contrib import admin

from . import views


urlpatterns = [
    url(r'^$',views.login,name='login'),

    #url('', views.edit_user),
    url(r'success/$', views.success),

]


cheers

Dylan Reinhold

ungelesen,
25.01.2018, 20:15:2025.01.18
an django...@googlegroups.com
It looks like the url.py you have listed is your app url.py and your project url *might* be linked to it with an include().
From the debug output something in your project url is named userprofile/ that could be linked to your app url (don't have the project url to be sure)

So you can try the url
http://127.0.0.1/userprofile/

Dylan

--
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...@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/CAPCf-y5%3Dcq-wrspYEdL-YjVWx%3DmvhRLBLo1M61ANrsDR87pRvg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Omar Abou Mrad

ungelesen,
26.01.2018, 01:13:1426.01.18
an django...@googlegroups.com
On Fri, Jan 26, 2018 at 3:01 AM, sum abiut <sua...@gmail.com> wrote:
Hi,
i am having some issues with my url pattern. i can't seem to figure out the problem. i am running django 1.11.

<.. snip..>
urls.py
from django.conf.urls import url
from django.contrib import admin

from . import views


urlpatterns = [
    url(r'^$',views.login,name='login'),

    #url('', views.edit_user),
    url(r'success/$', views.success),

]


What's confusing you is the '^$' pattern which you believe should be 
activated if you navigate to "http://localhost:8000/" where in fact this
will point to the root url module under your rbv_payslip package.

That root url module has a pattern called "userprofile" which in turn
includes the url file you posted above. If you look closely at the error
you're getting, django is telling you that it could not find the pattern
you tried, but it found "admin" and "userprofile". The latter should
work for you.

Have a look at this part of the tutorial:


Regards,

rajen...@rxprism.com

ungelesen,
26.01.2018, 07:30:0626.01.18
an Django users
def login(request):
    return render(request,'login.html')

sum abiut

ungelesen,
28.01.2018, 19:59:0328.01.18
an django...@googlegroups.com
Thanks heaps manage to fix it.



--
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...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
Allen antworten
Antwort an Autor
Weiterleiten
0 neue Nachrichten