run a .py app on apache with apache wsgi

109 Views Asked by At

I'm a librarian from school. I'm trying to understand how to set up a .py app on apache which using wsgi.

I found a tool called "Majax2", it is a tool that help the library to scrape some standard format from the library catalog and display it on another webpage. You may see the demo page, in the MAJAX output column, it is the output majax2 scrapped(http://libx.lib.vt.edu/services/majax2/bibrecord/2275560) from the library catalog(http://addison.vt.edu/search/.b2275560/.b2275560/1,1,1,E/marc&FF=.b2275560#.VuzyyKd96Uk) and show the bibliographic information or circulation status( 4 copies found: due 09-12-16, available, due 06-11-16, due 10-13-16). See the first record(.b2275560).

code: https://github.com/godmar/majax2

demo page: http://libx.lib.vt.edu/services/majax2/

I install a new Ubuntu 14.04 vm, and follow the steps to set up the environment.

sudo apt-get update
sudo apt-get install python-pip
sudo pip install Django
sudo apt-get install apache2
sudo apt-get install libapache2-mod-wsgi
sudo apt-get install libapache2-mod-wsgi-py3

I put all the code in /var/www/html/services/majax2, so in this folder, I have .htaccess index.html majax2.js and majax.py

And I edit the apache.conf file and add the line at the beneath of the file

  WSGIScriptAlias /services/majax2 /var/www/html/services/majax2/majax2.py/

  Alias /services/majax2/ /var/www/html/services/majax2/
  AddType text/html .py

  <Directory /var/www/html/services/majax2/>
      Order deny,allow
      Allow from all
  </Directory>

Actually, I really have no idea what wsgi and py ... is. I searched the internet and followed the instructions to set up the environment. But it seems there are still lots of problems to solve.

I got the error message as below

cat /var/log/apache2/error.log
[Sat Mar 19 13:59:05.983780 2016] [mpm_event:notice] [pid 12749:tid 139938135115648] AH00489: Apache/2.4.7 (od_wsgi/3.4 Python/2.7.6 configured -- resuming normal operations
[Sat Mar 19 13:59:05.983840 2016] [core:notice] [pid 12749:tid 139938135115648] AH00094: Command line: '/usrche2'

I hope if someone is good at py or have experience using apache wsgi may give me a hand. I need to set up my own environment which can run my own majax service instead of the producer's. Hope you may provide some information or some hint to solve my problem. It's very kind of you if you may tell me which step is wrong or what I should do to make "majax2.py" run. Thanks a lot.

0

There are 0 best solutions below