wtreston wtreston -4 years ago 73
Python Question

Django URLs arent working

Keep getting a 404 error whenever I try and access the site.

This is my urls.py in my app called

userprofile
:

urlpatterns = [
url(r'ˆ$', views.index, name = 'index')
]


These are my urls.py:

from userprofile import urls


urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'ˆusers/', include('userprofile.urls')),
]


and this is my views.py:

def index(request):
return HttpResponse("Hello, world. You're at the polls index.")


I don't get any errors in the console.

Traceback:
Not Found: /users/
[11/Jun/2017 17:17:47] "GET /users/ HTTP/1.1" 404 2036


and I have tried
/users/

Answer Source

You're using a different albeit look-alike character instead of the regex line start character:

ˆ

Instead of:

^

>>> 'ˆ' == '^'
False
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download