Install in hostgator

2,249 views
Skip to first unread message

pepe_eloy

unread,
May 14, 2011, 12:21:13 AM5/14/11
to web2py-users
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

pbreit

unread,
May 14, 2011, 12:58:50 AM5/14/11
to web...@googlegroups.com
Maybe have a look here:

But I would definitely recommend Webfaction or Ubuntu in the cloud. Zero reason to mess around with lousy hosting providers.

pepe_eloy

unread,
May 14, 2011, 3:29:12 PM5/14/11
to web2py-users
Hello!

do you think hostgator is a bad hosting provider? I've development
joomla applications and they works well and the support system is very
good.

pity that site hostgator.web2py.es doesn't works to learn how deploy
my application

Anybody has another answer?

Thanks

Syed Mushtaq

unread,
May 17, 2011, 2:40:11 AM5/17/11
to web...@googlegroups.com
Hi , 
I followed http://web2pyslices.com/main/slices/take_slice/76 to run web2py on hostmonstor , I believe it should be a similar setup for hostgator .

You can check my sample site at http://web2py.igurukul.net/newsfeed

Thanks
-Syed

Brian M

unread,
May 18, 2011, 8:48:49 PM5/18/11
to web...@googlegroups.com
Yep it'll work similar on hostgator - tried it out a few months back just to see if I could get it working, haven't actually deployed anything useful but it appears to run ok.  I recall that an appropriate version of Python & flup were already installed on my hostgator shared box. I did my install of web2py into a subfolder rather than the site root which probably made things harder.  Here's that I can quickly grab from my setup, sorry didn't take detailed notes :(


.htaccess
--------------
AddHandler fcgid-script .fcgi 
Options +FollowSymLinks  +ExecCGI 
RewriteEngine On 
RewriteBase /web2py/ 
RewriteRule ^dispatch\.fcgi/ - [L] 
RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]


dispatch.fcgi
-------------------
#!/usr/bin/python2.7 
import sys 
from flup.server.fcgi_fork import WSGIServer 
import gluon.main 
application=gluon.main.wsgibase 
## or 
# application=gluon.main.wsgibase_with_logging 
WSGIServer(application).run() 

routes.py (sorry honestly don't remember if I changed this or not, think I had to add the /web2py/ because I put web2py in a subfolder of the site)
------------------------
#routes_in = ((r'.*:/favicon.ico', r'/examples/static/favicon.ico'),
#             (r'.*:/robots.txt', r'/examples/static/robots.txt'),
#             ((r'.*http://otherdomain.com.* (?P<any>.*)', r'/app/ctr\g<any>')))
routes_in = (('/web2py/(?P<a>.*)','/\g<a>'),)

# routes_out, like routes_in translates URL paths created with the web2py URL()
# function in the same manner that route_in translates inbound URL paths.
#

#routes_out = ((r'.*http://otherdomain.com.* /app/ctr(?P<any>.*)', r'\g<any>'),
#              (r'/app(?P<any>.*)', r'\g<any>'))
routes_out=(('/(?P<a>.*)','/web2py/\g<a>'),)

Tito Garrido

unread,
Aug 14, 2012, 7:40:55 PM8/14/12
to web...@googlegroups.com
Hi Brian,

I tried a similar setup but I wasn't able to run it... Were you able to run web2py in hostgator?
When I try to run it from ssh I get:
lanc...@lancesegols.com [~/public_html/lancesegols.com]# python web2py.py
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2011
Version 1.99.7 (2012-03-04 22:12:08) stable
Database drivers available: SQLite3, pymysql, pg8000, IMAP
Starting hardcron...
choose a password:
no password, no admin interface
please visit:
    http://127.0.0.1:8000
use "kill -SIGTERM 31355" to shutdown the web2py server
Fatal Python error: Couldn't create autoTLSkey mapping
Aborted (core dumped)


Not sure what is wrong... I have put web2py source inside public_html is it the right path?

My dispatch.fcgi
#!/home/lanceseg/local/bin/python

import sys
from flup.server.fcgi_fork import WSGIServer
import gluon.main
application=gluon.main.wsgibase
## or
# application=gluon.main.wsgibase_with_logging
WSGIServer(application).run()


My .htaccess:

AddHandler fcgid-script .fcgi
Options +FollowSymLinks  +ExecCGI
RewriteEngine On
RewriteBase /
RewriteRule ^dispatch\.fcgi/ - [L]
RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]


Not usre what is wrong but there is not a good tutorial for hostgator.

Regards,

Tito
--

Linux User #387870
.........____
.... _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:_______

Rob_McC

unread,
Aug 15, 2012, 2:01:04 PM8/15/12
to web...@googlegroups.com, pepe...@gmail.com
Hi:

I have several separate hosting accounts on hostgator, for last 6 years,
been happy, good support, php runs well, wordpress, joomla, drupal etc.

But, for web2py, I now have an account on:
    https://www.webfaction.com/

I have hosting on GAE, but many issues there I wasn't happy with...

They support web2py, and it worked immediately for me,
and I have submitted maybe a dozen trouble ticket on various things...
like
SMTP working with web2py
https:// working with web2py
PostgreSQL <- which I have working with web2py
and various other topics.

Their support is excellent and friendly.

Rob

Promo from website:
Old-style web hosting is dead! No more slow and crowded servers with old software and no flexibility. We provide fast and reliable hosting with a modern and flexible setup. Our hosting plan starts at $5.50/mo with free setup and comes with a 60-day money back guarantee so you can't go wrong. Feel free to browse around and don't hesitate to email us or chat with us if you have any question.

Kevin C

unread,
Aug 29, 2012, 4:24:19 PM8/29/12
to web...@googlegroups.com, pepe...@gmail.com
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

desta

unread,
Jan 31, 2014, 12:36:47 PM1/31/14
to web...@googlegroups.com
I am writing to update this method. We have followed the instructions included above but we kept getting an internal server error 500.

The problem was that we had no experience how virtualenv works! So first you need to create one with the following command:
virtualenv /home/<USER>/python

The problem was here, that this virtualenv missing the flup module. So to install you first need to run
source /home/<USER>/python/bin/activate

and then run

pip install flup


After that, it should work. Make sure you run the instructions from the previous posts.

I hope this helps someone.

On Wednesday, April 17, 2013 8:28:07 PM UTC+3, Diogo Munaro wrote:
Thx man! You help me a lot!!

Mạnh Trần Đức

unread,
Mar 10, 2014, 8:21:42 AM3/10/14
to web...@googlegroups.com
I 've bought Hatchling package hosting on hostgator.
I tried install web2py on subfolder public_html/web2py but it was not successful.
Server response 500 default status of hostgator: http://moneytweak.com/web2py/

This is my .htaccess and index.fcgi in web2py folder:
###.htaccess:
AddHandler fcgid-script .fcgi 
Options +FollowSymLinks  +ExecCGI 
RewriteEngine On 
RewriteBase /web2py/ 
RewriteRule ^index\.fcgi/ - [L] 
RewriteRule ^(.*)$ index.fcgi/$1 [L]

###index.fcgi:
#!/home/user/env/bin/python
import sys, os
sys.path.append('/home/user/public_html/web2py')
os.chdir('/home/user/public_html/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()

###routes.py
default_application = 'init'    # ordinarily set in base routes.py
default_controller = 'default'  # ordinarily set in app-specific routes.py
default_function = 'index'      # ordinarily set in app-specific routes.py
routes_in = (('/web2py/(?P<a>.*)','/\g<a>'),)
routes_out=(('/(?P<a>.*)','/web2py/\g<a>'),)
logging = 'debug'

Can anybody help me, plz?

RTBS

unread,
Mar 24, 2014, 3:56:44 PM3/24/14
to web...@googlegroups.com
When I used your commands, I got python2.6 in my virtualenv.

====================

To specify python2.7, rather than python2.6, in the virtualenv see below.
In my example '/home/<USER>/python' == '<path to your new virtualenv>'

1) 
virtualenv -p /usr/local/bin/python2.7 <path to your new virtualenv>

2) 
source <path to your new virtualenv>/bin/activate

3) 
pip install flup

4) 
deactivate
This is the command to leave your virtualenv.  To re-enter, use the command in #2.
====================

My project does not load (Error 500).  From reading this forum, I think these are the required steps.  Is this correct?

1. create a virtualenv and install flup
2. create a file '.htaccess' in the 'public_html' directory
      2.1 edit content in /home4/<USER>/public_html/.htaccess
3. create a file 'index.fcgi' in the public_html' directory
      3.1 edit content in /home4/<USER>/public_html/index.fcgi
4. make the index.fcgi file executable (I used cpanel 'File Manager' to set the permissions on this file to 755)
5. Download the source code for web2py from the web2py website.
      5.1 FTP or SCP the zip file to your /home4/<USER> directory
      5.2 Use the unzip command to put web2py at /home4/<USER>/web2py
6. Copy the 'routespatterns.example.py' file from /home4/<USER>/web2py/examples to /home4/<USER>/web2py
      6.1 rename the file 'routes.patterns.example.py' to 'routes.py'
      6.2 edit content in /home4/<USER>/web2py/routes.py

====================

I sent a ticket to their support team about utilizing mod_wsgi or fcgi, knowing that web2py would not be supported.  Will this even work with the 'Hatchling' package?  Perhaps I am wasting my time and need to change hosting providers.

From my support ticket:
Currently, our Reseller and Shared plans (Hatchling, Baby, and Business) are set up with suPHP, and would require an upgrade if you needed to use a different handler. We have Apache 2.2 and 2.4 available for our VPS and Dedicated servers, and Apache 2.2 for our shared environment.

In order to use fcgi or mod_wsgi, it is required that you upgrade to either a VPS or a Dedicated server solution. Both of these packages allow for custom configuration of nearly any aspect of your server, and give you full control over your software. 

Any pointers would be appreciated. Thanks!

RTBS

unread,
Apr 1, 2014, 2:02:21 PM4/1/14
to web...@googlegroups.com
To try to narrow down where my error is I executed my *.fcgi file.  Please see below.  I still get Error 500 when visiting the domain.  How do these parameters get set?


[~/public_html]# ./dispatch.fcgi
WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
Status: 303 SEE OTHER
Content-Type: text/html; charset=UTF-8
Location: /web2py/welcome/default/index
Content-Length: 73

You are being redirected <a href="/web2py/welcome/default/index">here</a>

RTBS

unread,
Apr 3, 2014, 3:18:39 PM4/3/14
to web...@googlegroups.com
In Hostgator's CPanel there is error logs area.  When i try to load the page, I get a 500 error in the browser and the following errors in the CPanel error log:

  File "/home4/<username>/local/web2py/gluon/contrib/pbkdf2_ctypes.py", line 22, in <module>
  File "/home4/<username>/local/web2py/gluon/utils.py", line 46, in <module>
  File "/home4/<username>/local/web2py/gluon/html.py", line 31, in <module>
  File "/home4/<username>/local/web2py/gluon/globals.py", line 21, in <module>
  File "/home4/<username>/local/web2py/gluon/__init__.py", line 15, in <module>

I have created a virtualenv called local and unzipped my web2py package in local.  This looks like it fails to import some packages basked on the lines where the issues occur.

Does my python path need to be altered?

RTBS

unread,
Apr 4, 2014, 7:40:19 PM4/4/14
to web...@googlegroups.com
You got it to work!
How did you do it?  What was wrong with it?

http://moneytweak.com/welcome/default/index

criss shirley

unread,
Apr 9, 2014, 1:43:10 PM4/9/14
to web...@googlegroups.com

Hey Everyone

I saw many of peoples asking about the best web hosting with best resultat so

 i‘m here to giving and sharing you my experience :

I have been with Hostgator for over 4 years now having moved from many different hosts before finding the right one, Hostgator. I have never had such a fantastic service from any company anywhere! Hostgator are simply the best you will find, the customer service is amazing, 24/7 and they help with all kinds of advice, even when it isnt server related. They have techs working for them that actually care for the customers and this has been proven time and time again when I had issues with scripts, even though it wasnt up to Hostgator to fix these issues, they gave me great advice to get the scripts working. I have a dedicated pro server, fully managed and a level 4 VPS, both are perfect for my entire business and I have a lot of sites!

Anyway, Hostgator are simply the best hosting company out there and that is the reason why they are so popular, if you are searching for a hosting company, you dont need to, just go to Hostgator!

If you are looking to host your website, my strongest advise is to go with Hostgator and you will never regret doing so…

With hostgator 1 cent coupon, you can get hostgator hosting in just 1 cent for first month.

 You can use following coupons to get discount:

$0.01 First Month, Coupon Code -----> markdownhost

To sign up in hostgator here : http://goo.gl/3cVZNd

RTBS

unread,
Apr 10, 2014, 1:28:14 PM4/10/14
to web...@googlegroups.com
Hey Criss,

Great testimonial and I would love to use hostgator.  However, I would also like to use web2py.  Currently, a complete tutorial does not exist to make these two work together.  It seems some people have been able to get this to work, unfortunately, I am not one of them.  

The django tutorial on the hostgator web page works great and only took about 10 min. to get working.  https://support.hostgator.com/articles/django-with-fastcgi

I am looking for something similar for web2py.  I really hate to tie up their support team on an issue that they shouldn't be supporting.  I'm surprised that no one has written a white-paper how-to on this one.  Maybe I'm missing something so simple that no one has bothered to mention it.

Thanks again, you have solidified my resolve to make this work (or at least ask their support team again).

LoveWeb2py

unread,
Mar 22, 2015, 10:24:56 PM3/22/15
to web...@googlegroups.com, kyle...@gmail.com
Did anyone ever find a complete solution to this? I'm using web2py on hostgator and after following this tutorial I can only get my app to work if I name it init. Also, if I try to access another controller for example: www.mysite.com/controller/ I get a 404 error. Does this have something to do with my htaccess or routes? They are setup exactly how this thread recommends

Carlos Costa

unread,
Mar 23, 2015, 10:53:08 PM3/23/15
to web...@googlegroups.com

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--


Carlos J. Costa
Cientista da Computação  | BS Computer Science
Esp. Gestão em Telecom   |
PgC Telecom Mangement
<º))><
Message has been deleted

Attique Tecnologia

unread,
Feb 20, 2016, 10:35:05 AM2/20/16
to web2py-users
Good my dear!
This topic seems to be off, but I'm having the same problem of our friend RTBs


WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
Status: 303 SEE OTHER
Content-Type: text/html; charset=UTF-8
Location: /web2py/welcome/default/index
Content-Length: 73

You are being redirected <a href="/web2py/welcome/default/index">here</a>

Someone managed to solve, I made a copy of the route-example file to my application, but is still the 500 error and this error when I run the terminal.
Reply all
Reply to author
Forward
0 new messages