user1409289
user1409289

Reputation: 542

Django url dispatcher page not found

i am trying to define a url pattern in django urls.py like

 url(r'^networking$','mysite1.networking.views.networking'), 

when i am typing http://myhost.com/networking in my address bar to go to networking page

i am getting 404 error and a slash '/' automatically added to the address bar like

http://myhost.com/networking/

help me out what i am doing wrong?

Upvotes: 1

Views: 198

Answers (3)

Vivek S
Vivek S

Reputation: 5540

Seems your Apache server or some Django middleware is adding trailing slashes. You can either correct that, or the better way is you can use the following url pattern:

url(r'^networking/?$','mysite1.networking.views.networking'), 

Upvotes: 0

sharafjaffri
sharafjaffri

Reputation: 2204

Either set Append_Slash to false which is true by default or use your url description like given below which redirect url with slash to desired view.

url(r'^networking/$','mysite1.networking.views.networking'),

Upvotes: 0

Sam Dolan
Sam Dolan

Reputation: 32532

You probably aren't including your urlconf correctly. The behavior you're seeing is because of APPEND_SLASH is set to True by default when Django can't resolve the url.

Upvotes: 3

Related Questions