Jason O.
Jason O.

Reputation: 3300

Webapp2.Route regex issue

I'm experiencing an issue where my get request in the browser returns 404 Resource cannot be found error, which seems to indicate that my webapp2.Route regex in the main.py is not matching the url.

app = webapp2.WSGIApplication(
[
webapp2.Route(r'/test_module/\?.*', handler=test_module.TestHandler, name='test_module'),
],
config=webapp2_config, debug=DEBUG)

The URL that I'm entering in the browser is

http://localhost:8080/test_module/?c=1

The reason I believe it's a regex issue is that if I change regex and URL to the following , the TestHandler runs with no problem.

webapp2.Route(r'/test_module', handler=...

http://localhost:8080/test_module

Please help.

Upvotes: 0

Views: 120

Answers (1)

Omair Shamshir
Omair Shamshir

Reputation: 2136

have you tried this

webapp2.Route(r'/test_module/', handler=test_module.TestHandler, name='test_module'),

i think you dont have to specify the ? in the router you can get these parameters by

self.request.get('c')

Upvotes: 2

Related Questions