For future reference, this is how we finally got this working on Hostgator. 
 The instructions should be very similar for pretty much any shared host 
running Fast-CGI.

We install web2py at /home/user/web2py
We created a virtualenv of Python 2.7 at /home/user/python (The server's 
python binary is at /usr/bin/python2.7)
We created an .htaccess and index.fcgi file using instructions found 
elsewhere.  But we kept getting internal server errors.  After debugging 
line by line, we saw that the import gluon.main line was failing because 
the web2py directory wasn't on python's path.  Once we fixed that, there 
was an error coming from gluon.main where it was trying to read the VERSION 
file.  So we had to add another line to change the working directory to the 
web2py directory.  After those two steps were done, everything began 
working beautifully.

Our index.fcgi
#!/home/user/python/bin/python
import sys, os
sys.path.append('/home/user/web2py')
os.chdir('/home/user/web2py')
from flup.server.fcgi_fork import WSGIServer
import gluon.main
application=gluon.main.wsgibase
# or
# application=gluon.main.wsgibase_with_logging
WSGIServer(application).run()

Our .htaccess
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteBase /
RewriteRule ^index\.fcgi/ - [L]
RewriteRule ^(.*)$ index.fcgi/$1 [L]

With the above changes, web2py is working beautifully on hostgator.

I hope this is useful for someone in the future.
On Tuesday, August 28, 2012 11:31:27 PM UTC-5, Kevin C wrote:
>
> Do you mind sharing how you got it working?  I have virtualenv with python 
> 2.7 set up, web2py in my home directory, index.fcgi (Executable) and an 
> .htaccess set up, but still no success.  I'm getting Internal Server Errors 
> on every page.  Can you share your configuration with us?
>
> On Friday, August 24, 2012 4:57:16 AM UTC-5, pitonb wrote:
>>
>> OK, got it to work:)
>>
>> On Thursday, August 23, 2012 1:22:27 PM UTC-7, pitonb wrote:
>>>
>>> Sorry to revive this thing a year later. I have taken a stab at this 
>>> yesterday and at 5 in the morning I was still nowhere trying to install w2p 
>>> under a shared hosting account. Has anyone gotten this to work on 
>>> hostgator? I would really appreciate some help. I have pretty much vacuumed 
>>> the web for installation instructions and tried them all, though they are 
>>> all very similar to what is described in this thread. I can't seem to get 
>>> anything but 404 response. Maybe I try to navigate the wrong URL.
>>>
>>> In a nut shell I have done the following:
>>>
>>> - installed web2py inside ~/public_html
>>> - created executable web2py.fcgi 
>>> - added the stuff to .htaccess
>>>
>>> At the end I was messing with routes.py a bit, but to no avail (I'm 
>>> fuzzy on how to interpret this stuff though). If you have a working config 
>>> on HG that would give me one of the w2p's wecome app to show or any sort of 
>>> HelloWorld kind of an app to work, I would appreciate you sharing it here. 
>>>
>>> On a related note, what would be the URL I would need to navigate to see 
>>> w2p welcome app after a successful w2p install, given the domain 
>>> www.blah.com and w2p installed ~/public_html? Would it be 
>>> www.blah.com/web2py/welcome?
>>>
>>> My plan at this point is to try django following the instructions from 
>>> HG support pages. Just want to make sure any python framework at all would 
>>> work. I have not done this yet and in the long run am not looking at using 
>>> django. 
>>>
>>> Thank you in a advance,
>>> -piton
>>>
>>> On Friday, May 13, 2011 9:21:13 PM UTC-7, pepe_eloy wrote:
>>>>
>>>> Hello! 
>>>>
>>>> Recently a customer bought a hosting plan (business) with hostgator. 
>>>> I'm developing for him a web2py application, I have doubts of how to 
>>>> deploy it. Somebody can help me? The application runs well in 
>>>> localhost (ubuntu). 
>>>>
>>>> Thanks in advance 
>>>>
>>>>

-- 



Reply via email to