Sunday, August 27, 2017

Setting Up mod wsgi and Web py with Apache on Ubuntu 14 04

Setting Up mod wsgi and Web py with Apache on Ubuntu 14 04


****** Very Rough Tutorial Here, I wrote it mostly as a reminder to myself as I have spent the whole night on this problem and I am quite exhausted, if anybody actually read this, forgive this rough article, leave comment if you think I might help you on this problem.

****** I will try to make this tutorial better when I have more time... Trying to develop a web app at the moment, so... I dont know when, but I will!

I spent 3 hours to have this working... so I might as well contribute a bit so you dont have to waste so much time as I did...

First thing that has to be said is - if you are developing on a Ubuntu 14.04 computer and you want to setup your web.py app using mod_wsgi and have it run on a Apache server -

The Tutorial on the web.py cookbook is out of date.

First of all, ignore the virtual Host Stuff, as it was said on the Cook Book:

Configure a website on Apache to load the mod_wsgi module. This can either be your default website, or another Virtual Host, which you can create by copying /etc/apache2/sites-available/default to something like/etc/apache2/sites-available/my-website. Add the following lines, under the DocumentRoot directive:

Well, to be fair, most part in the tutorial still works in 14.04, but the parts that doesnt will certainly give you a lot of trouble.

Where the cookbook tells you to find something under /ect/apache2/sites-available/default <---- the default stuff is no longer available in Ubuntu 14.04, instead, a file named 000-default.conf is there which we need to configure.

From there, you should be able to find the DirectoryRoot stuff there like this:

ServerAdmin webmaster@localhost

DocumentRoot /var/www/html

Under this line, add the two / three lines the cookbook tells us to, save the configuration file (forgot to mention, you will need root to edit this file, so run "sudo gedit 000-default.conf" from terminal), run the sudo a2ensite my-website  command, just to be safe, you might want to restart apache using "sudo service apache2 restart" as well

Then, create the code.py file as instructed by the cookbook, try entering the address of your code.py in a browser, there you go!



download file now

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.