0

I am using Apache/2.2.29 in Cent OS. Have installed modwsgi and I have a page being served by MyPage.wsgi. Now I want to receive HTTP Get variables and have written the following inside the httpd.conf.

WSGIScriptAliasMatch url_part_after_root/(.*)/(.*)/(.*) actual_pythonpage.wsgi?p1=$1&p2=$2&p3=$3

However it does not work. Am I missing something? Thank!

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895
Vinodh
  • 896
  • 1
  • 15
  • 28
  • 1
    Don't try to write raw WSGI apps. Use a micro framework like Flask. – Daniel Roseman Jun 18 '15 at 08:40
  • 2
    The reason I say that is that those frameworks have methods for extracting parts of URLs and using them as parameters to handler methods, which means you don't have to do it as part of the Apache configuration. – Daniel Roseman Jun 18 '15 at 09:00
  • 1
    You can't attach a query string to the end of the WSGI script path like how you are doing. It would be taken as part of the file name. Technically there may be a way of making it work with a minor tweak, but I am with @DanielRoseman, use a Python web framework to do it, so would rather not suggest the tweak as would regard it as bad practice and would screw up calculation of URLs for redirects etc. – Graham Dumpleton Jun 18 '15 at 09:57
  • Sure. Thanks for the insights. I will evaluate Django and Flask and choose one of them, as I here they are the most widely used ones now. Probably I will ask how Django/Flask get the GET params using WSGI. But this question may be wrong as I have never used Django.Thanks for the immediate response. – Vinodh Jun 18 '15 at 10:32
  • For Flask see http://stackoverflow.com/questions/14032066/flask-optional-url-parameters – Graham Dumpleton Jun 18 '15 at 10:53
  • for Django: https://docs.djangoproject.com/en/1.8/ref/request-response/ – Brandon Taylor Jun 18 '15 at 11:01
  • I wanted this to be real simple without going through any framework. What is the best way to do it in WSGI itself? – Vinodh Jun 18 '15 at 15:02

0 Answers0