Deploying cherrypy on bluehost

267 views
Skip to first unread message

brahmaforces

unread,
Jan 10, 2009, 6:44:22 AM1/10/09
to cherrypy-users
Hello All:

My app is finally (not completely but enough to test online and launch
to the world) or else i will forever be developing on my local
machine.

I have gotten putty fired and logged in...My web host is blue host.

1) Where should I install cherrypy?
2) Are there any server wide versus user scope issues in a shared
hosting situation?

Do I need to modify anything else on the server?

brahmaforces

unread,
Jan 10, 2009, 6:45:33 AM1/10/09
to cherrypy-users
Hello All:

My app is finally (not completely but enough to test online and launch
to the world) or else i will forever be developing on my local
machine.

I have gotten putty fired and logged in...My web host is blue host.

1) Where should I install cherrypy?
2) Are there any server wide versus user scope issues in a shared
hosting situation?
3) How do i do the install on the server? ie what command might i use
to install cherrypy on the server using ssh?

arjuna

unread,
Jan 10, 2009, 7:16:58 AM1/10/09
to cherrypy-users
Hello All Again:

On my local machine I am using cherrypy 3.0.3. Should I upload this to the server? If I upload the latest version, will my code still work?

Here is an approach I have thought of that is quite straightforward, do I need to do anything else:

1) Create a scratch folder on the server in www.
2) Download the latest version of cherrypy. Ftp this up to the scratch folder on the server
3) Manually unpack and install it (Yum and sudo dont seem to be working on bluehost)
--
Best regards,
arjuna
http://www.brahmaforces.com

Glenn Linderman

unread,
Jan 10, 2009, 3:50:24 PM1/10/09
to cherryp...@googlegroups.com
Sounds like we are all in approximately the same boat...


To start from the beginning, for folks that might not have SSH set up at
bluehost, see: http://nevcal.com/eclectic/bluessh/bluehost-ssh.html


The cherrypy.org tutorials speak of how to configure cherrypy via
mod_python, mod_proxy, and other ways... Bluehost doesn't support those
ways, though. From their tech support, I learned that the only only
technique they support besides standard CGI is FCGI, which they mostly
support for PHP... but they say it should work for other things:

> For fcgi files to work on Bluehost you just need to make sure that
>
> 1) apache is using the right handler (AddHandler fastcgi-script .fcgi)
> 2) that the script has 755 permissions
> 3) that the script has the right shebang at the top of the file
> (/usr/bin/sh , /usr/bin/perl etc..)
To that I add: (don't use /usr/bin/env in the shebang, Apache has a
different environment than ssh)

So in .htaccess, I have the following lines:

AddHandler fcgid-script .fcgi
RewriteRule ^(errdoc.cgi(.*))$ /cgi-bin/$1 [last]
RewriteRule ^(cgi-bin/cherry.fcgi/.*)$ - [last]
# RewriteRule ^(.*$) /cgi-bin/cherry.fcgi/$1

The first corresponds to bluehost's step 1. The next is to allow my
error-document-generating script to be served by Apache, without use of
CherryPy. You could have different files here, or include any static
files you do not want served by CherryPy. Or you could be more explicit
in restricting which URLs you want to have served by CherryPy in the
subsequent lines.

The third line causes any URL that are are already explicitly invoking
cherrypy to be resolved without going through the rest of my (complex)
.htaccess. [All the complexity after these lines is already simulated in
CherryPy, in fewer lines, if I can get it to work fully.]

The final line, commented out, redirects ALL other URLs to CherryPy.
This allows the web site to work as it presently does, without the
enhancements I hope to use CherryPy for. If I can get CherryPy working,
I can uncomment this line, and the rest of the .htaccess will become
useless and can eventually be removed/archived. For testing, I simply
add cgi-bin/cherry.fcgi into the URLs I want to test.

I wanted a newer Python (2.6) so I followed the instructions at
http://eli.thegreenplace.net/2008/10/20/installing-python-25-on-bluehost/
but used a different version. I didn't package this as a single shell
script (yet).


Then I followed approximately the following instructions
http://www.tabruyn.com/site/index.php?option=com_content&view=article&id=55:tortoisesvn-subversion-and-bluehost&catid=36:digital&Itemid=58
to install SVN and flup. Not sure I actually needed this stuff.

Here is the script I reworked from that site, and updated with newer
versions, and made it easier to edit the version numbers, by abstracting
them to variables.

aprv=1.3.3
cd ~
mkdir src
cd ~/src
wget http://www.gtlib.gatech.edu/pub/apache/apr/apr-$aprv.tar.gz
tar -xzf apr-$aprv.tar.gz
cd ~/src/apr-$aprv
./configure --prefix=$HOME LDFLAGS="-L/lib64"
make
make install

apruv=1.3.4
cd ~
mkdir src
cd ~/src
wget http://www.gtlib.gatech.edu/pub/apache/apr/apr-util-$apruv.tar.gz
tar -xzf apr-util-$apruv.tar.gz
cd ~/src/apr-util-$apruv
./configure --prefix=$HOME --with-apr=$HOME LDFLAGS="-L/lib64"
make
make install

neonv=0.28.3
cd ~
mkdir src
cd ~/src
wget http://www.webdav.org/neon/neon-$neonv.tar.gz
tar -xzf neon-$neonv.tar.gz
cd ~/src/neon-$neonv
./configure --enable-shared --prefix=$HOME LDFLAGS="-L/lib64"
make
make install

svnv=1.5.4
cd ~
mkdir src
cd ~/src
wget http://subversion.tigris.org/downloads/subversion-$svnv.tar.gz
tar -xzf subversion-$svnv.tar.gz
cd ~/src/subversion-$svnv
# ./configure --prefix=$HOME --without-berkeley-db --with-zlib
--with-ssl LDFLAGS="-L/lib64"
./configure --prefix=$HOME --without-berkeley-db --with-ssl
LDFLAGS="-L/lib64"
make
make install

flupv=1.0.1
cd ~
mkdir src
cd ~/src
wget http://www.saddi.com/software/flup/dist/flup-$flupv.tar.gz
tar -xzf flup-$flupv.tar.gz
cd flup-$flupv
python setup.py install


And here is a script to install cherrypy 3.1.1, which includes cherryd,
which seems to replace the need for flup, perhaps.


chv=3.1.1
cd ~
mkdir src
cd ~/src
wget http://download.cherrypy.org/cherrypy/$chv/CherryPy-$chv.tar.gz
tar -xzf CherryPy-$chv.tar.gz
cd CherryPy-$chv
python setup.py install
# invoke cherryd as
# /home2/areliabl/src/CherryPy-3.1.1/cherrypy/cherryd -c myconfig? -d -f
-i nevcal.py

To use CherryPy with Python 2.6, one must patch it slightly (or use the
trunk), see issue #891 in the CherryPy tracker, quickly fixed by
Robert/fumanchu.

Since cherryd starts with
#! /usr/bin/env python

and that won't work when launched from Apache, either you need to use a
shell script to set up a path and then invoke cherryd, or you need to
edit cherryd and put in a hard-coded path to the python you want.
Thinking that fewer steps are faster, I opted for the latter, and first
copied cherryd to my cgi-bin as cherry.fcgi, changed the shebang line,
and ripped out the parameter parsing at the bottom (because Apache isn't
going to pass parameters either).

I replaced the parameter parsing with one line:

start( daemonize=True, fastcgi=True, imports=["mycherrysetup"])

but I haven't gotten it working yet... whether I need other parameters
or whether there is some other bug, is unknown yet.

I need a breakthrough here. I wasn't going to write all this up until I
had it all working, but this should get you as far as I have... then
maybe you will see the problem I'm having and help me... we all have
different experience in different things, of course.

--
Glenn -- http://nevcal.com/
===========================
A protocol is complete when there is nothing left to remove.
-- Stuart Cheshire, Apple Computer, regarding Zero Configuration Networking

Robert Brewer

unread,
Jan 11, 2009, 1:00:00 AM1/11/09
to cherryp...@googlegroups.com

We'd sure welcome a writeup like this at
http://tools.cherrypy.org/wiki/BluehostDeployment -- add to it as you
go.


Robert Brewer
fuma...@aminus.org

Glenn Linderman

unread,
Jan 11, 2009, 1:37:01 AM1/11/09
to cherryp...@googlegroups.com
On approximately 1/10/2009 10:00 PM, came the following characters from
the keyboard of Robert Brewer:

> We'd sure welcome a writeup like this at
> http://tools.cherrypy.org/wiki/BluehostDeployment -- add to it as you
> go.

I'll give it a whirl. I've used MediaWiki a bit, but not this one.

v+python

unread,
Jan 11, 2009, 3:24:51 AM1/11/09
to cherrypy-users
On Jan 10, 10:00 pm, "Robert Brewer" <fuman...@aminus.org> wrote:

> We'd sure welcome a writeup like this at
> http://tools.cherrypy.org/wiki/BluehostDeployment-- add to it as you
> go.


OK, you have it. I'll be happy to adjust it if you release a 3.1.2
containing the necessary patches for issues #891 and #894... I didn't
writeup how to apply those patches, in hopes that it wouldn't be
necessary.

If there isn't a release planned in the near future, is there a .tgz
file of the trunk available for use with installs, that could be
substituted? Or dated snapshots?

There's one other feature that I find missing: directory indexes Any
change of getting support for that?

I've written what I consider to be an optimal directory listing, you
can see an example at http://nevcal.com/cp/recipelist/ -- note the
TITLE= text contains date and file size, rather than cluttering the
display with that. Usually the user isn't concerned with that until
he chooses a file, and then it would pop up anyway :)

The directory listing code is presently affixed to the CherryPy
application tree explicitly in the right spot for this, with a helper
function to pass in the directory name of the directory to list.

What I'd prefer is for the directory listing code to get invoked for
any staticly served directory that doesn't have an index.html file.

I guess this would be possible as a tool, but I haven't figured out
how to detect the proper condition, or set up tools to execute in the
right order. Maybe I could, if I experimented a while, but if you can
point me in the right direction, or already know how to do that, that
would be great.

I suppose it would be possible to tweak the implementation of
staticdir to have an extra parameter tools.staticdir.ls which would
be None for today's functionality, but if set to a callable, would get
executed. I haven't figured out how to calculate the current URL
prefix in effect when a handler is called, as yet, as so far, I've
just hard-coded it to match the "well-known" spot in the tree where
the handler lives. For this usage, it would also be necessary to have
the directory name that corresponds to the URL prefix.

Advice welcome, and I'll be glad to debug pseudo-code, and contribute
back my listing generation code as a sample function, once I get
everything working.

v+python

unread,
Jan 11, 2009, 11:45:36 AM1/11/09
to cherrypy-users
Another technique for index (directory listing) generation, would be
to allow the tools.staticdir.index to be either a string (filename as
today) or an object. As an object, it could check for the existence
of one or more different files to control its behavior (if there is
index.html just use it, or if there is index.py (appropriate owned and
secured), run it, or... do some internal python, like listing the
directory, or whatever.

arjuna

unread,
Jan 12, 2009, 11:36:42 AM1/12/09
to cherryp...@googlegroups.com
Hi Glen:

Seems like you have been down the road and back...I'm just starting down the Bluehost deployment road, so I will reference your post as I go along. I guess what you are describing are apache issues on Bluehost and the setting of the config files.

Even before that I tried to unpack the tar.gz files for cherrypy and other modules i use in my python code and i got a whole bunch of permission denied errors. It seems you have to be root or in any case bluehost did not permit me to install my own packages using ssh and putty.

Instead they asked to provide a list of all the packages i wanted installed by creating a ticket and they would install them for me in 24 hours. So the plan is to install all the packages including the latest version of cherrypy and the recommended version of python, and then i will start going through:

1) Documentation on deploying cherrypy on or behind or... on apache'
2) Your post on the fine tuning and config issues

Thanks and will post on this thread regarding any problems or experiences till my app is up and running on bluehost...and then you all will be able to see it too...

I chatted with one of the support guys over at bluehost (they have an online chat) so you

Glenn Linderman

unread,
Jan 12, 2009, 1:01:09 PM1/12/09
to cherryp...@googlegroups.com
On approximately 1/12/2009 8:36 AM, came the following characters from
the keyboard of arjuna:

> Hi Glen:
>
> Seems like you have been down the road and back...I'm just starting
> down the Bluehost deployment road, so I will reference your post as I
> go along. I guess what you are describing are apache issues on
> Bluehost and the setting of the config files.

Exactly! Some of the roads were blind alleys, but I do have a patched
CherryPy now successfully deployed at Bluehost. It is not perfect, but
it works. Perfection awaits the CherryPy 3.1.2 release.

What I am describing is a bug in CherryPy 3.1.1 that prevents it from
working it the environment that Bluehost supports. There were no Apache
issues, although if Bluehost did support other FCGI configurations,
either of them could be used successfully with CherryPy 3.1.2.

> Even before that I tried to unpack the tar.gz files for cherrypy and
> other modules i use in my python code and i got a whole bunch of
> permission denied errors. It seems you have to be root or in any case
> bluehost did not permit me to install my own packages using ssh and putty.

My latest writeup is at
http://tools.cherrypy.org/wiki/BluehostDeployment per Robert's request,
and it is trimmed a bit to what I think was actually necessary to get an
up-to-date Python/CherryPy deployed on Bluehost, rather than
_everything_ I did.

Consider what I wrote here to be a prototype of the writeup that is
there, and use it as a reference.

You are not root at Bluehost, so you cannot install stuff in the
"default" locations. If you use the preinstalled version of Python at
Bluehost, you will need to somehow convince it to install your packages
somewhere else, and I haven't figured out how to do that (too new to
Python).

What I have figured out (from various helpful web sites) is how to
install my own Python, and then installing packages using that Python
works fine. The key point to this comes in my Step 2, with the commands

cd Python-$pyv
./configure --prefix="$HOME"


This causes the install of Python to go to my Bluehost $HOME directory,
instead of to /, and I have permissions to my $HOME directory, as you
will also to yours.


> Instead they asked to provide a list of all the packages i wanted
> installed by creating a ticket and they would install them for me in
> 24 hours.

The unfortunate part about this approach is that at present, there is no
latest version of CherryPy that actually works on Bluehost. It must be
patched. So if they install the latest released version, 3.1.1, it will
not work, and you will not be able t o patch it... they will need to
patch it. Besides CherryPy, you will need flup. Beyond that, it depends
on what you need for your particularly CherryPy application that may or
may not already be installed at Bluehost.

If you install your own Python (or figure out how to install Python
packages to your own directory, I think that is possible by setting some
environment variables or something), then you can install CherryPy 3.1.1
and patch it, or wait for CherryPy 3.1.2 and install that.

> So the plan is to install all the packages including the latest
> version of cherrypy and the recommended version of python, and then i
> will start going through:
>
> 1) Documentation on deploying cherrypy on or behind or... on apache'
> 2) Your post on the fine tuning and config issues

Consider all that I have written here prior to this message to be
superseded by http://tools.cherrypy.org/wiki/BluehostDeployment and the
content of http://cherrypy.org/ticket/894

> Thanks and will post on this thread regarding any problems or
> experiences till my app is up and running on bluehost...and then you
> all will be able to see it too...

Great! Communicating our successes and failure symptoms will help to
resolve them.

> I chatted with one of the support guys over at bluehost (they have an
> online chat) so you

I have too, on occasion. Not sure if you intended to say more here --
that sentence seems unfinished. You seem to have chatted with one that
was more helpful, or at a less busy time, as none that I have talked to
have offered to install Python packages for me.

Jeff Hinrichs - DM&T

unread,
Jan 12, 2009, 6:53:30 PM1/12/09
to cherryp...@googlegroups.com
>
>> Even before that I tried to unpack the tar.gz files for cherrypy and
>> other modules i use in my python code and i got a whole bunch of
>> permission denied errors. It seems you have to be root or in any case
>> bluehost did not permit me to install my own packages using ssh and putty.
>
...

>
> You are not root at Bluehost, so you cannot install stuff in the
> "default" locations. If you use the preinstalled version of Python at
> Bluehost, you will need to somehow convince it to install your packages
> somewhere else, and I haven't figured out how to do that (too new to
> Python).
>
You may want to look at virtualenv, http://pypi.python.org/pypi/virtualenv
virtualenv doesn't answer the question if you want a different version
of python than what your host has installed, but if what you want is
the ability to install site-packages that your code can access, then
virtualenv is the ticket.

CherryPy works great with virtualenv, I do all my cherry pickin' in it.

Nice job on the write up, stuff like that is outstanding for projects
like cherrypy. There is no way that Robert and crew can do these wiki
articles, they are up to users like you and me.

regards,

Jeff

Pete H

unread,
Jan 13, 2009, 4:16:08 AM1/13/09
to cherrypy-users


On Jan 12, 11:53 pm, "Jeff Hinrichs - DM&T" <dunde...@gmail.com>
wrote:
> >> Even before that I tried to unpack the tar.gz files for cherrypy and
> >> other modules i use in my python code and i got a whole bunch of
> >> permission denied errors. It seems you have to be root or in any case
> >> bluehost did not permit me to install my own packages using ssh and putty.
>
> ...
>
> > You are not root at Bluehost, so you cannot install stuff in the
> > "default" locations.  If you use the preinstalled version of Python at
> > Bluehost, you will need to somehow convince it to install your packages
> > somewhere else, and I haven't figured out how to do that (too new to
> > Python).
>
> You may want to look at virtualenv,http://pypi.python.org/pypi/virtualenv
> virtualenv doesn't answer the question if you want a different version
> of python than what your host has installed, but if what you want is
> the ability to install site-packages that your code can access, then
> virtualenv is the ticket.
>
> CherryPy works great with virtualenv, I do all my cherry pickin' in it.
>
> Nice job on the write up, stuff like that is outstanding for projects
> like cherrypy.  There is no way that Robert and crew can do these wiki
> articles, they are up to users like you and me.
>
> regards,
>
> Jeff

There is no need for complex solutions like virtualenv with CherryPy.
Just unpack the distribution and copy the cherrypy directory somewhere
you have access to, then add the following two lines of code so that
they run before any imports of cherrypy:

if not sys.path[0] == 'path/to/mycp':
sys.path.insert(0, 'path/to/mycp')

Then you can tinker with CP to your heart's desire without nneding
root access to anything. I'm running like this at ppdb.org.uk on a
shared host under mos_wsgi (devisland.net) where I can't install my
own CP anyway.

Pete

brahmaforces

unread,
Feb 19, 2009, 7:18:21 AM2/19/09
to cherrypy-users
Hi Glen:

Thanks for creating this writeup and adding it to the wiki. I have
followed it and your advice and learned a lot of things including:

1) Bluehost cannot do it for you you must do it yourself on bluehost
2) Install python 2.6 in your home area (instructions are available on
the internet and in this thread before)
3) Install any other python modules including cherrypy, templating and
other include modules

I have done all of the above and also got flup installed.

I did STEP 4 in your writeup. I created a new folder on Bluehost.
Copied a .htaccess file in there, copied my cherrypy app/python file
in there:

Here is my question:

1) The Step 5 you have listed does not explain how to do what you are
saying. Could you break step 5 down a bit. In the wiki it is listed as
below:
-------------------------------------------------------------------------
Step 5 ¶

Create an .fcgi file so Apache will start the FCGI process.

Since cherryd starts with #! /usr/bin/env python

and that won't work when launched from Apache, you need to do one of
the following:

A) use a shell script called /cgi-bin/cherryd.fcgi to set up a path
(to give /usr/bin/env something to work with) and then invoke cherryd

B) invoke cherryd with an explicit python, using cherryd as a
parameter, something like the following, but change /home/myaccount to
your home directory for your account. This assumes your CherryPy
application is in mycherrysetup.py in the same directory as cherryd.
Again, the script should probably be named /cgi-bin/cherryd.fcgi

/usr/bin/sh
/home/myaccount/bin/python /home/myaccount/src/CherryPy-3.1.1/cherrypy/
cherryd -c myconfig -d -f -i mycherrysetup

C) edit cherryd and put in a hard-coded path to the python you want.
Rename cherryd to /cgi-bin/cherryd.fcgi.

Thinking that fewer steps are faster, I opted for the latter, and
first copied cherryd to /cgi-bin/cherryd.fcgi, changed the shebang
line to /home/myaccount/bin/python, and ripped out the parameter
parsing at the bottom (because Apache isn't going to pass parameters
either).

I replaced the parameter parsing with one line:

start( configfiles=["myconfig"], daemonize=False,
fastcgi=True, imports=["mycherrysetup"])

-------------------------------------------------

2) You mentioned some patches have to be installed for the 3.1.1
version of cherrypy for them to work with python2.6. I have not
installed these. Where do i get them from and do i simply unpack and
python setup them. Basically how do i install the patches?

3) How do i fire up the cherrypy server on bluehost?

Thanks in advance...I am almost there the last few steps are
left...Cant wait to see my cherrypy app up on the internet....






On Jan 12, 11:01 pm, Glenn Linderman <v+pyt...@g.nevcal.com> wrote:
> On approximately 1/12/2009 8:36 AM, came the following characters from
> the keyboard of arjuna:
>
> > Hi Glen:
>
> > Seems like you have been down the road and back...I'm just starting
> > down theBluehostdeployment road, so I will reference your post as I
> > go along. I guess what you are describing are apache issues on
> >Bluehostand the setting of the config files.
>
> Exactly! Some of the roads were blind alleys, but I do have a patched
> CherryPy now successfully deployed atBluehost. It is not perfect, but
> it works. Perfection awaits the CherryPy 3.1.2 release.
>
> What I am describing is a bug in CherryPy 3.1.1 that prevents it from
> working it the environment thatBluehostsupports. There were no Apache
> issues, although ifBluehostdid support other FCGI configurations,
> either of them could be used successfully with CherryPy 3.1.2.
>
> > Even before that I tried to unpack the tar.gz files for cherrypy and
> > other modules i use in my python code and i got a whole bunch of
> > permission denied errors. It seems you have to be root or in any case
> >bluehostdid not permit me to install my own packages using ssh and putty.
>
> My latest writeup is athttp://tools.cherrypy.org/wiki/BluehostDeploymentper Robert's request,
> and it is trimmed a bit to what I think was actually necessary to get an
> up-to-date Python/CherryPy deployed onBluehost, rather than
> _everything_ I did.
>
> Consider what I wrote here to be a prototype of the writeup that is
> there, and use it as a reference.
>
> You are not root atBluehost, so you cannot install stuff in the
> "default" locations. If you use the preinstalled version of Python atBluehost, you will need to somehow convince it to install your packages
> somewhere else, and I haven't figured out how to do that (too new to
> Python).
>
> What I have figured out (from various helpful web sites) is how to
> install my own Python, and then installing packages using that Python
> works fine. The key point to this comes in my Step 2, with the commands
>
> cd Python-$pyv
> ./configure --prefix="$HOME"
>
> This causes the install of Python to go to myBluehost$HOME directory,
> instead of to /, and I have permissions to my $HOME directory, as you
> will also to yours.
>
> > Instead they asked to provide a list of all the packages i wanted
> > installed by creating a ticket and they would install them for me in
> > 24 hours.
>
> The unfortunate part about this approach is that at present, there is no
> latest version of CherryPy that actually works onBluehost. It must be
> patched. So if they install the latest released version, 3.1.1, it will
> not work, and you will not be able t o patch it... they will need to
> patch it. Besides CherryPy, you will need flup. Beyond that, it depends
> on what you need for your particularly CherryPy application that may or
> may not already be installed atBluehost.
>
> If you install your own Python (or figure out how to install Python
> packages to your own directory, I think that is possible by setting some
> environment variables or something), then you can install CherryPy 3.1.1
> and patch it, or wait for CherryPy 3.1.2 and install that.
>
> > So the plan is to install all the packages including the latest
> > version of cherrypy and the recommended version of python, and then i
> > will start going through:
>
> > 1) Documentation on deploying cherrypy on or behind or... on apache'
> > 2) Your post on the fine tuning and config issues
>
> Consider all that I have written here prior to this message to be
> superseded byhttp://tools.cherrypy.org/wiki/BluehostDeployment and the
> content ofhttp://cherrypy.org/ticket/894
>
> > Thanks and will post on this thread regarding any problems or
> > experiences till my app is up and running onbluehost...and then you
> > all will be able to see it too...
>
> Great! Communicating our successes and failure symptoms will help to
> resolve them.
>
> > I chatted with one of the support guys over atbluehost(they have an
> > online chat) so you
>
> I have too, on occasion. Not sure if you intended to say more here --
> that sentence seems unfinished. You seem to have chatted with one that
> was more helpful, or at a less busy time, as none that I have talked to
> have offered to install Python packages for me.
>
> --
> Glenn --http://nevcal.com/

brahmaforces

unread,
Feb 19, 2009, 7:26:17 AM2/19/09
to cherrypy-users
Two more questions:

1) WHat is CherryD and where do i get it

2) Do i create a cgi-bin directory in the folder on bluehost where i
have put my cherrypy app? Or does this go into some kind of general
cgi-bin folder for the website in general?

Thanks in advance...

Arjuna

Glenn Linderman

unread,
Feb 19, 2009, 2:20:07 PM2/19/09
to cherryp...@googlegroups.com
So Apache is configured by Bluehost

On approximately 2/19/2009 4:18 AM, came the following characters from
the keyboard of brahmaforces:


> Hi Glen:
>
> Thanks for creating this writeup and adding it to the wiki. I have
> followed it and your advice and learned a lot of things including:
>
> 1) Bluehost cannot do it for you you must do it yourself on bluehost
> 2) Install python 2.6 in your home area (instructions are available on
> the internet and in this thread before)
> 3) Install any other python modules including cherrypy, templating and
> other include modules
>
> I have done all of the above and also got flup installed.
>
> I did STEP 4 in your writeup. I created a new folder on Bluehost.
> Copied a .htaccess file in there, copied my cherrypy app/python file
> in there:
>

So to step 4 I added a new paragraph:
> The .htaccess file must be in or below the public_html directory, and
> the cgi-bin referred to must be in the public_html directory, or the
> corresponding subdirectory for the subdomain or add-on domain. I used
> .htaccess and cgi-bin in the public_html, and the paths in the
> examples reflect that.

Not sure where you created your .htaccess, but Apache on bluehost in
configured to look at public_html as the "root" path for serving URLs
for each account/domain. Subdomains and add-on domains may be at lower
levels... not sure if they allow configuring anything at higher or in
parallel to public_html, but I doubt it. Anyway, these files must be
findable by Apache according to its rules, and Bluehost's configuration,
and your configuration.

> Here is my question:
>
> 1) The Step 5 you have listed does not explain how to do what you are
> saying. Could you break step 5 down a bit. In the wiki it is listed as
> below:
>

Hmm. Not sure where you are having problems, so hardly know what to
break down, or give more detail about... I wonder if your main issue was
the one above, but if not, well, I'll answer as many of your other
issues as I can, and you can keep asking questions, and I'll keep
editing the wiki. Glad you are using it, by providing feeback, you will
make it more useful to other people... hard to know what all to write,
although I tried to be complete.

> -------------------------------------------------------------------------
> Step 5 ś

The patches are given in the tickets that I referred to in step three.
Basically, cherrypy is just a bunch of Python files, which are text
files, so you can just edit the files mention, and change them to look
like what is in the patch. I was sort of hoping that there would be a
new release of CherryPy incorporating these patches before (very many)
people would follow these instructions so didn't go into detail there,
on how to apply the patches, figuring it would be ripped out later when
the release happened. Not sure what the release schedule is for
CherryPy, as I'm still pretty new to it myself.

> 3) How do i fire up the cherrypy server on bluehost?
>
> Thanks in advance...I am almost there the last few steps are
> left...Cant wait to see my cherrypy app up on the internet....
>

It is this combination of .htaccess and cgi-bin/cherry.fcgi that starts
cherrypy via FCGI, once you get all the incantations correct for your
environment.


From your next message (and I think you were starting to see the light
about where to put things):

> Two more questions:
>
> 1) WHat is CherryD and where do i get it
>

cherryd is part of the cherrypy distribution/installation. Copy and
change. I've added the following paragraph to step 5 in the wiki:
> In the CherryPy distribution, there is a file cherryd, which
> allows/demonstrates starting and configuring a CherryPy server daemon
> (I think that is where the "d" comes from in the name) in a variety of
> environments.

> 2) Do i create a cgi-bin directory in the folder on bluehost where i
> have put my cherrypy app? Or does this go into some kind of general
> cgi-bin folder for the website in general?
>

For the main domain (and all parked domains share it), and for each
add-on domain, and for each subdomain, there is a corresponding cgi-bin
created for you by bluehost. This is the cgi-bin directory of
interest... the one that corresponds to the [sub]domain on which you
wish to run the cherrypy server. Remember that Apache is in control,
and Apache only looks in the places that bluehost configures it to look.

--
Glenn -- http://nevcal.com/

brahmaforces

unread,
Mar 15, 2009, 8:23:27 AM3/15/09
to cherrypy-users
Hi Glen:

Despite the delay, (got busy with some paid consulting...which always
helps specially in times of recession) I am back to my cherrypy
app...:) Ok so where were we..

1) I had to put in the two patches 1) to make cp play well with python
2.6 2) to make it play with apache. Following your instructions I
simply downloaded the files from the the links you posted on the wiki
(listed earlier in this post) and ftped them up to the server. So i am
assuming they are now in effect.

2) I did step 4 and copied your lines into the htaccess file which i
put in the public html directory

3) on step 5 like you i am going for the Option C which seems the
simplest. However here is my question:

You say:
--------------------------
C) edit cherryd and put in a hard-coded path to the python you want.
Rename cherryd to /cgi-bin/cherryd.fcgi.

Thinking that fewer steps are faster, I opted for the latter, and
first copied cherryd to /cgi-bin/cherryd.fcgi, changed the shebang
line to /home/myaccount/bin/python, and ripped out the parameter
parsing at the bottom (because Apache isn't going to pass parameters
either).

I replaced the parameter parsing with one line:

start( configfiles=["myconfig"], daemonize=False,
fastcgi=True, imports=["mycherrysetup"])

----------------------------
question 1) There are 2 configuration files in cherrypy 1) the global
one 2) one specific to my app...Which one does "myconfig" refer to

question 2) What is "mycherrypysetup"

question 3) Doing a "whereis python" on bluehost via ssh i get many
paths to python2.6 which one should i use?/

question 4) At what point do i uncomment the last line in htaccess and
how do i test my cherrypy app

question 5) My global conf file is as follows:

[global]
server.socket_host = "localhost"
server.socket_port = 8080
server.thread_pool = 10

# remove any limit on the request body size; cherrypy's default is
100MB
# (maybe we should just increase it ?)
server.max_request_body_size = 0

# increase server socket timeout to 60s; we are more tolerant of bad
# quality client-server connections (cherrypy's defult is 10s)
server.socket_timeout = 60


Do i need to change the localhost to something else on the bluehost
server?

Thanks in advance...A bit of friendly feedback for your wiki post.
While everything upto point 4 is self explanatory (except how to
install patches which you clarified in your post) Point 5 needs
clarification along the above dimensions. (in the spirit of making
your post even more helpful)

Thanks...


On Feb 20, 12:20
> > Step 5 ¶
> Glenn --http://nevcal.com/

brahmaforces

unread,
Mar 15, 2009, 8:34:07 AM3/15/09
to cherrypy-users
After making all the changes in the wiki how do i startup the site? on
the localhost we simply go:

http://localhost:8080/

and away we go...what do i do on my bluehost...

Also i am not clear about the subdomains
I have a main domain and a subdomain. I have made the changes to the
public html (htaccess and cgi bin) for the main domain. I assume this
will mean that this will inherit down the subdomain and cherrypy will
process the subdomain. But what of the other subdomains? Will they run
naturally or will cherrypy try to run them?

Thanks again

brahmaforces

unread,
Mar 15, 2009, 8:39:18 AM3/15/09
to cherrypy-users
When I try to point the browser to the path where the cherrypy files
are stored it simply lists the contents of the directory and then
says:

Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8i DAV/2
mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
mod_rbl1.0 Server at www.karunaworks.com Port 80

Is cherrypy running?

On Mar 15, 5:23 pm, brahmaforces <brahmafor...@gmail.com> wrote:

arjuna

unread,
Mar 15, 2009, 9:29:07 AM3/15/09
to cherrypy-users
When I run my app going to the right directory, using ssh typing python myappname.py it runs but it says

no module named MySQLdb

I understand that this particular module has path issues related to mysql, any experience regarding where mysql sits on bluehost or how to get MySQLdb to run on bluehost?

arjuna

unread,
Mar 15, 2009, 10:45:47 AM3/15/09
to cherrypy-users
For the record and other simpletonts like me that may follow in migrating their cherrypy app to the server specifically to bluehost:

1) The modules like MySQLdb and other module that the python code imports is simply installed. I have a src directory in my root folder/home(on my bluehost account) Here I upload the tar.gz files and simply unpack them and run the appropriate setup commands (python setup.py install   and so on) I now have all my packages installed.

2) It also seems to be trying to run cherrypy when i type python myappname.py

However I figure i have some tuning to do as i am now getting the following error:

 a) A whole bunch of Depreciation warnings (for md5, sha, mysql db) any ideas on how to get rid of these?

b) It starts the engine but tries to serve it on localhost:8080 (guess i have to tinker with my config file)




On Sun, Mar 15, 2009 at 6:59 PM, arjuna <brahma...@gmail.com> wrote:
When I run my app going to thelright directory, using ssh typing python myappname.py it runs but it says

arjuna

unread,
Mar 15, 2009, 11:02:23 AM3/15/09
to cherrypy-users
I changed the localhost to mywebsitename and then mywebsitename.com and then www.mywebsitename.com, but it says:

port 80 not free on (each of the above)

brahmaforces

unread,
Mar 18, 2009, 1:42:53 AM3/18/09
to cherrypy-users
Dear All:


I am still stuck on this issue and still getting the IO error: port 80
not free on....(ip address or url) I have tried google and searched
the archives, and have read the config behind apache section but am
not able to find a solution any help will be appreciated...

On Mar 15, 8:02 pm, arjuna <brahmafor...@gmail.com> wrote:
> I changed the localhost to mywebsitename and then mywebsitename.com and thenwww.mywebsitename.com, but it says:
>
> port 80 not free on (each of the above)
>
> On Sun, Mar 15, 2009 at 8:15 PM, arjuna <brahmafor...@gmail.com> wrote:
> > For the record and other simpletonts like me that may follow in migrating
> > their cherrypy app to the server specifically to bluehost:
>
> > 1) The modules like MySQLdb and other module that the python code imports
> > is simply installed. I have a src directory in my root folder/home(on my
> > bluehost account) Here I upload the tar.gz files and simply unpack them and
> > run the appropriate setup commands (python setup.py install and so on) I
> > now have all my packages installed.
>
> > 2) It also seems to be trying to run cherrypy when i type python
> > myappname.py
>
> > However I figure i have some tuning to do as i am now getting the following
> > error:
>
> > a) A whole bunch of Depreciation warnings (for md5, sha, mysql db) any
> > ideas on how to get rid of these?
>
> > b) It starts the engine but tries to serve it on localhost:8080 (guess i
> > have to tinker with my config file)
>
> > On Sun, Mar 15, 2009 at 6:59 PM, arjuna <brahmafor...@gmail.com> wrote:
>
> >> When I run my app going to thelright directory, using ssh typing python
> >> myappname.py it runs but it says
>
> >> no module named MySQLdb
>
> >> I understand that this particular module has path issues related to mysql,
> >> any experience regarding where mysql sits on bluehost or how to get MySQLdb
> >> to run on bluehost?
>
> >> On Sun, Mar 15, 2009 at 6:09 PM, brahmaforces <brahmafor...@gmail.com>wrote:
>
> >>> When I try to point the browser to the path where the cherrypy files
> >>> are stored it simply lists the contents of the directory and then
> >>> says:
>
> >>> Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8i DAV/2
> >>> mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
> >>> mod_rbl1.0 Server atwww.karunaworks.comPort 80
> >>> > am, Glenn Linderman <v+pyt...@g.nevcal.com <v%2Bpyt...@g.nevcal.com>>
> ...
>
> read more »

Tim Roberts

unread,
Mar 18, 2009, 1:44:37 PM3/18/09
to cherryp...@googlegroups.com
brahmaforces wrote:
> I am still stuck on this issue and still getting the IO error: port 80
> not free on....(ip address or url) I have tried google and searched
> the archives, and have read the config behind apache section but am
> not able to find a solution any help will be appreciated...
>

If you are running Apache on port 80, then you cannot have CherryPy also
serve on port 80. Only one app at a time can claim a port number. You
have to run CherryPy on another port number.

Which scheme are you using to run CherryPy behind Apache?

--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

brahmaforces

unread,
Mar 19, 2009, 9:08:37 AM3/19/09
to cherrypy-users
Hi Tim:

Since I am deploying cherrypy in a shared hosting environment on
Bluehost, I am following Glen's page in the wiki which is about
installing cherrypy on bluehost. For your reference, it is here:

http://tools.cherrypy.org/wiki/BluehostDeployment

In this Glen says:
----------------------------
---------------------------------------

So i have simply followed his instructions...From what i gather we are
using FCGI as per the instructions above...
> Tim Roberts, t...@probo.com
> Providenza & Boekelheide, Inc.

brahmaforces

unread,
Mar 19, 2009, 9:21:48 AM3/19/09
to cherrypy-users
For those who follow later in trying to install their cherrypy app on
bluehost, it seems we are using fcgi, and since i dont know what it is
and maybe you may not either heres a link that seems to describe it:

http://en.wikipedia.org/wiki/FastCGI

(this assumes fcgi is FastCGI)

arjuna

unread,
Mar 19, 2009, 10:13:15 AM3/19/09
to cherryp...@googlegroups.com
I think the IO error port 80 not free on "IPADDRESS" may be because in my global conf file i have a server and port line where i set them to 80 and an ip address. I just took out those lines and this error is gone and i am getting other errors. It seems to be starting up cherrypy but then shutting down due to some errors. I am tweaking my app level conf file for paths maybe they are causing the errors. The static paths.

If i am using fcgi, then do i still need to specify a port and host in my global conf file?

arjuna

unread,
Mar 19, 2009, 10:14:15 AM3/19/09
to cherryp...@googlegroups.com
Maybe it is a configuration issue where i need to set up my global and app level conf files for fcgi and not as it was on my localhost. any ideas on this?

arjuna

unread,
Mar 19, 2009, 10:45:58 AM3/19/09
to cherryp...@googlegroups.com
Hi All:

I am trying to paste the Cherrypy  i am getting on ssh, they are cherrypy errors however Putty does not let me copy and paste so i  am off to find another ssh client that does allow me to do that...and then i will paste the traceback...i hope when i applied the patches as below:

---- Note that presently, you need CherryPy 3.1.1 and any patches for http://www.cherrypy.org/ticket/891 (to work with Python 2.6) & http://www.cherrypy.org/ticket/894 (to work with Bluehost/Apache/dynamic FCGI). Hopefully, the CherryPy trunk, or a future versions 3.1.2 will be available soon, containing all the patches, and you can use that.
-------

I hope that I did not mess up the source files. I simply downloaded the files in the above links and replaced the ones that were in my cherrypy distribution.

In any case I will try and install another ssh client and post the traceback...

arjuna

unread,
Mar 19, 2009, 10:57:47 AM3/19/09
to cherryp...@googlegroups.com
Ok folks the IO PORT NOT AVAILABLE ON IP ADDRESS issue is resolved!!!!

I simply needed a higher port number, i put

host: mydomain name
port:2000

and it worked!!!

It started serving but then shut down due to other errors...

Type Error: formatwarning() takes 5 exactly arguments (6 given)
this is in the file warnings.py

which seems to be an internal cherrypy file...

I will once again try to install a different ssh client to copy and paste the traceback...But its a relief that the IO port not available error is finally resolved...

Sylvain Hellegouarch

unread,
Mar 19, 2009, 11:06:23 AM3/19/09
to cherryp...@googlegroups.com

> Ok folks the IO PORT NOT AVAILABLE ON IP ADDRESS issue is resolved!!!!
>
> I simply needed a higher port number,

Unix/Linux means you have to be root to be able to use ports below 1024.

- Sylvain


--
Sylvain Hellegouarch
http://www.defuze.org

arjuna

unread,
Mar 19, 2009, 11:11:31 AM3/19/09
to cherryp...@googlegroups.com
I guess im learning in the school of hard knocks, it took me a week to figure that out...

Regarding the new error:


Type Error: formatwarning() takes 5 exactly arguments (6 given)
this is in the file warnings.py

I did a google search and Tim had advised someone to revert from Python 2.6 to 2.5 and that person's error went away. Do i need to do this, or is there another way?/

Glen seemed to have his install on bluehost working fine with python 2.5?

Sylvain Hellegouarch

unread,
Mar 19, 2009, 11:20:13 AM3/19/09
to cherryp...@googlegroups.com
Try disabling the checker first:

cherrypy.config.update({"checker.on": False})

I seem to recall it was coming from it.

- Sylvain

Robert Brewer

unread,
Mar 19, 2009, 11:25:53 AM3/19/09
to cherryp...@googlegroups.com
arjuna wrote:
> Type Error: formatwarning() takes 5 exactly arguments (6 given)

This occurs due to changes between Python 2.5 and 2.6. It was fixed in
CherryPy trunk in http://www.cherrypy.org/changeset/2096. Other
Python-2.6-related fixes:

* http://www.cherrypy.org/changeset/2104
* http://www.cherrypy.org/changeset/2063

Robert Brewer
fuma...@aminus.org

arjuna

unread,
Mar 19, 2009, 11:28:50 AM3/19/09
to cherryp...@googlegroups.com
ALRIGHT!!! We have lift off!!! Cherrypy has started online!!! Thanks all, will post my site as soon as i clean up the design a bit in the next few days!!!!Wow!

arjuna

unread,
Mar 19, 2009, 11:35:46 AM3/19/09
to cherryp...@googlegroups.com
For those who follow: (and myself :)

Post starting issues:

Cherrypy has started, when i look in ssh via putty.

It says
serving on mydomain:2000

however when i go to http://www.mydomain:2000

it says connecting.... and nothing happens (unlike the magic that happens on my localhost)

Any ideas?

Jeremiah Dodds

unread,
Mar 19, 2009, 12:11:40 PM3/19/09
to cherryp...@googlegroups.com
On Thu, Mar 19, 2009 at 3:35 PM, arjuna <brahma...@gmail.com> wrote:
For those who follow: (and myself :)

Post starting issues:

Cherrypy has started, when i look in ssh via putty.

It says
serving on mydomain:2000

however when i go to http://www.mydomain:2000

it says connecting.... and nothing happens (unlike the magic that happens on my localhost)

Any ideas?

Make sure the port is open on the machine. I don't know much about bluehost, but from a quick google it looks like you have to have a dedicated IP to use non-standard ports.



arjuna

unread,
Mar 19, 2009, 12:19:47 PM3/19/09
to cherryp...@googlegroups.com
Ok I have asked Bluehost the question whether port 2000 is open since it is a non standard port.

Another issue that is bothering me is:

I have put my cherrypy app and conf files in a subfolder as below:

mdomain/subfolder/

However the host is: mydomain.com

(if i try to set up mydomain.com/subfolder/ as the host i get an error)

How do I run my cherrypy site from a subfolder in the domain?

Could this be causing the problem?

arjuna

unread,
Mar 19, 2009, 12:23:31 PM3/19/09
to cherryp...@googlegroups.com
I tried connecting as follows:

http://www.mydomain.com:2000/subfolder/

The above seems logical enough. I am not sure if it is correct for the cherrypy setup...

However i am still getting the connecting.....(hang)

problem, even though cherrypy says server is running on mydomain:2000

arjuna

unread,
Mar 19, 2009, 12:25:44 PM3/19/09
to cherryp...@googlegroups.com
If I try connecting with any number larger than 2000 i get the same connecting hang... somehow it is not able to detect the cherrypy on 2000....

arjuna

unread,
Mar 19, 2009, 12:39:36 PM3/19/09
to cherryp...@googlegroups.com
Jermiah:

I think you are right...I may have to buy a dedicated IP, which is fine but i wanted to make sure that this is necessary and will solve the problem. This would be answered by anyone else out there who has deployed cherrypy in a shared hosting scenario (i think there would be many people who fit this category) I assume that they would all need a port, and since ports below 1024 are reseved for root, they would need non standard higher ports, in which case, as the argument goes, they would have to buy IPs.

So have all the users who have deployed in a shared environment bought dedicated IPS?

arjuna

unread,
Mar 19, 2009, 12:43:18 PM3/19/09
to cherryp...@googlegroups.com
Bluehost support has this to say about limitations on ports and buying IP addresses for those who follow this bread crumb trail...


http://helpdesk.bluehost.com/kb/index.php?x=&mod_id=2&id=460

Tim Roberts

unread,
Mar 19, 2009, 1:06:05 PM3/19/09
to cherryp...@googlegroups.com
arjuna wrote:
> i All:
>
> I am trying to paste the Cherrypy i am getting on ssh, they are
> cherrypy errors however Putty does not let me copy and paste so i am
> off to find another ssh client that does allow me to do that...and
> then i will paste the traceback...

Putty DOES support cut and paste -- it just uses the X style rather than
the Windows style. As soon as you select a block of text with the
mouse, Putty immediately copies it to the clipboard. No additional
command is needed. To do paste, you just right-click in the window.

Robert Brewer

unread,
Mar 19, 2009, 4:43:55 PM3/19/09
to cherryp...@googlegroups.com
arjuna wrote:
> It says serving on mydomain:2000
> however when i go to http://www.mydomain:2000
> it says connecting.... and nothing happens
> (unlike the magic that happens on my localhost)

If that 'serving on...' message is spit out by CherryPy, then you
certainly do *not* want that port to be accessible to the outside world.
That is the port which CherryPy is listening on for FastCGI messages
from Apache on the same machine; it is NOT an HTTP port.

-----\ ---------\ -----------
| CP 2000 <-FastCGI-> | Apache 80 <-HTTP-> | Browser |
-----/ ---------/ -----------


Robert Brewer
fuma...@aminus.org

arjuna

unread,
Mar 20, 2009, 12:53:09 AM3/20/09
to cherryp...@googlegroups.com
I googled that and found that out about putty,  but it is still not working may be because instead of a mouse i use a touchpad (it still has the left and right buttons) This is because my laptop is on its last legs and all the USB ports are shod, so no mouse...just touchpad, it should work buy when i select a block and right click where i want to paste, nothing happens...

arjuna

unread,
Mar 20, 2009, 12:56:17 AM3/20/09
to cherryp...@googlegroups.com
Robert:

So does that mean i should not buy the ip address to make port 2000 accessible to the world?

Based on your diagram you seem to be saying that the browser will access cherrypy through apache on port 80. This means i should be typing;

http://www.mydomain.com:80/subdirectory

However when i do this i get a straight listing of files in my subdirectory and not the running cherrypy app. While in putty it says the engine is started in a normal way...

Where do i go from here?

arjuna

unread,
Mar 20, 2009, 12:59:17 AM3/20/09
to cherryp...@googlegroups.com
I have cherrypy running, and when i point to the domain I get the directory listing with my app file and conf files and the following line below:

Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8i DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_rbl1.0 Server at karunaworks.com Port 80

Does this communicate anything?

arjuna

unread,
Mar 20, 2009, 1:39:43 AM3/20/09
to cherryp...@googlegroups.com
Since Robert is saying ( I think thats what you are saying...) that i should not get the ip address, then do you think my problem could be caused by the fact that my files are not sitting in the root of my public_html directory but in a subdirectory? The problem again is that the server is running I have no errors other than the depreceation errors (which i am getting despite having patched the files that are supposed to make them go away) but when i point to the url in the browser it says connecting and nothing happens or it shows me a list of files in the directory...

Tim Roberts

unread,
Mar 20, 2009, 2:47:10 AM3/20/09
to CherryPy
You wrote:
>
>So does that mean i should not buy the ip address to make port 2000
>accessible to the world?

No. Your interface to the outside world will be Apache on port 80.

>Based on your diagram you seem to be saying that the browser will access
>cherrypy through apache on port 80. This means i should be typing;
>
>http://www.mydomain.com:80/subdirectory
>
>However when i do this i get a straight listing of files in my
>subdirectory and not the running cherrypy app. While in putty it says
>the engine is started in a normal way...

And have you configured a .htconfig file to enable FCGI for that subdirectory? Is FCGI the scheme you had planned to use?

arjuna

unread,
Mar 20, 2009, 1:54:48 AM3/20/09
to cherryp...@googlegroups.com
Any ideas then why my app is not showing on the url while i get no errors on ssh and cherrypy starts up?

arjuna

unread,
Mar 20, 2009, 2:01:01 AM3/20/09
to cherryp...@googlegroups.com


And have you configured a .htconfig file to enable FCGI for that subdirectory?  Is FCGI the scheme you had planned to use?
--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.


In Glen's wiki, we configure a .htaccess file, but this is sitting in the public_html directory. Let me move it to the subdirectory and play with it and see what happens...Thanks for the pointer...


I used FCGI only because Glen another user here wrote a wiki that says that FCGI is the ONLY way to run cherrypy on Bluehost. I dont know the pros and cons of FCGI and whether my will run fast or slow and any other limitations, but if it is the only choice on my existing web host that becomes the logical choice.

By the way, where is the best place to host a cherrpy app on the internet or some good places atleast where i can run cherrypy so that it will run in an optimum way.

Does FCGI havee any limitations compared to the other methods of running behind apache?


arjuna

unread,
Mar 20, 2009, 2:12:57 AM3/20/09
to cherryp...@googlegroups.com
My .htaccess file which sits in the public_html folder and the sub folder is as follows based on Glen's wiki entry:

# Use PHP5CGI as default
AddHandler fcgid-script .php

The above 2 lines were there from before from something else.

AddHandler fcgid-script .fcgi
RewriteRule ^(errdoc.cgi(.*))$ /cgi-bin/$1 [last]
RewriteRule ^(cgi-bin/cherryd.fcgi/.*)$ - [last]
RewriteRule ^cp/(.*)$ /cgi-bin/cherryd.fcgi/$1 [last]
RewriteRule ^(.*)$ /cgi-bin/cherryd.fcgi/$1 [last]


I even tried to move all the files to the root public_html folder and call it directly as in

http://www.maydomain.com:80/

Still got a straight list of files served by apache not the cherrypy magic, even though it is running?

arjuna

unread,
Mar 20, 2009, 2:37:44 AM3/20/09
to cherryp...@googlegroups.com
Despite patching the files that are supposed to make the Depreciation messages go away they are still there?

Jeremiah Dodds

unread,
Mar 20, 2009, 6:37:04 AM3/20/09
to cherryp...@googlegroups.com

Oh man, I somehow missed that arjuna was running behind Apache with FastCGI. That'll show me to open my mouth before knowing that I'm not giving horrible advice.

Robert Brewer

unread,
Mar 20, 2009, 10:59:39 AM3/20/09
to cherryp...@googlegroups.com
arjuna wrote:
> Since Robert is saying ( I think thats what you are saying...)
> that i should not get the ip address

Correct.

> then do you think my problem could be caused by the fact that
> my files are not sitting in the root of my public_html directory
> but in a subdirectory?

No. Ideally, your cherrypy application files shouldn't be under the
Apache DocumentRoot (public_html) because of the security risk. If you
misconfigure Apache (as you seem to have done ;), then those files are
readable by the world, who may then have access to vulnerable source
code, database passwords and the like. Those files should be somewhere
else (but finding a "somewhere else" that Apache has permissions on is
not always simple). Those files should *only* be accessible via your
cgi-bin/cherryd.fcgi script.

Your htaccess says:

AddHandler fcgid-script .php

Try removing that line.


Robert Brewer
fuma...@aminus.org

Tim Roberts

unread,
Mar 20, 2009, 1:04:17 PM3/20/09
to cherryp...@googlegroups.com
arjuna wrote:
My .htaccess file which sits in the public_html folder and the sub folder is as follows based on Glen's wiki entry:

# Use PHP5CGI as default
AddHandler fcgid-script .php

The above 2 lines were there from before from something else.

AddHandler fcgid-script .fcgi
RewriteRule ^(errdoc.cgi(.*))$ /cgi-bin/$1 [last]
RewriteRule ^(cgi-bin/cherryd.fcgi/.*)$ - [last]
RewriteRule ^cp/(.*)$ /cgi-bin/cherryd.fcgi/$1 [last]
RewriteRule ^(.*)$ /cgi-bin/cherryd.fcgi/$1 [last]

But what did you call your CherryPy app?  Do you have a file called "cherryd.fcgi" in your /cgi-bin/ subdirectory?  That's what the rewrite rules want.

You seem to be flailing around here without any real understanding of what you're trying to connect.  Somehow, you need to tell Apache which requests should be routed to your CherryPy FCGI handler.  I've never set up an FCGI CherryPy script, so I can't give you the recipe, but there certainly are recipes on the web.  You need to UNDERSTAND those recipes, not just blindly copy config files from the web and cross your fingers to hope that they work.



I even tried to move all the files to the root public_html folder and call it directly as in

http://www.maydomain.com:80/

You do not need the :80.  HTTP requests default to port 80.  The port number is only required if you want a port other than 80 (which you do not).

That request will try to find a default page handler in the root directory of your virtual domain.  If no default handler was specified in the HTTP config file or an .htconfig, then Apache will look for index.html or index.htm.  Not finding that, Apache will present the directory.  This tells me that you have not yet configured things to route requests to your CherryPy handler.



Still got a straight list of files served by apache not the cherrypy magic, even though it is running?

Your CherryPy script is never going to get involved until you convince Apache to route requests for your domain to the script.  That, apparently, is not done yet.



By the way, where is the best place to host a cherrpy app on the internet or some good places atleast where i can run cherrypy so that it will run in an optimum way.

You are a long ways from worrying about the "optimum".  First, make it work.  Then, worry about performance.

Tim Roberts

unread,
Mar 20, 2009, 1:04:49 PM3/20/09
to cherryp...@googlegroups.com
arjuna wrote:
> I googled that and found that out about putty, but it is still not
> working may be because instead of a mouse i use a touchpad (it still
> has the left and right buttons) This is because my laptop is on its
> last legs and all the USB ports are shod, so no mouse...just touchpad,
> it should work buy when i select a block and right click where i want
> to paste, nothing happens...

Trackpad makes no difference. I use those on almost all of my systems.

I was unclear in my directions. In Putty, you just select the block to
"copy". In Putty, you just right-click to "paste".

But if you want to copy from Putty to Notepad, you select the block in
Putty, switch to Notepad, then do Ctrl-V or Edit->Paste. It's just the
normal cut-and-paste scheme, except that the Putty application spells
the commands differently.

arjuna

unread,
Mar 22, 2009, 1:40:25 AM3/22/09
to cherryp...@googlegroups.com
Hi Tim:

I found out so much on google, i select in putty and click the left mouse button to copy, then i move over to gmai or leafpad that i want to paste in, neighther the right click nor ctrl v are pasting...Strange...Just like my installing the patch for making the python 2.6 depreciations warnings go away, and they are still there...

On Fri, Mar 20, 2009 at 10:34 PM, Tim Roberts <ti...@probo.com> wrote:

arjuna wrote:
> I googled that and found that out about putty,  but it is still not
> working may be because instead of a mouse i use a touchpad (it still
> has the left and right buttons) This is because my laptop is on its
> last legs and all the USB ports are shod, so no mouse...just touchpad,
> it should work buy when i select a block and right click where i want
> to paste, nothing happens., t

Trackpad makes no difference.  I use those on almost all of my systems.

I was unclear in my directions.  In Putty, you just select the block to
"copy".  In Putty, you just right-click to "paste".

But if you want to copy from Putty to Notepad, you select the block in
Putty, switch to Notepad, then do Ctrl-V or Edit->Paste.  It's just the
normal cut-and-paste scheme, except that the Putty application spells
the commands differently.

--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.



arjuna

unread,
Mar 22, 2009, 2:09:27 AM3/22/09
to cherryp...@googlegroups.com
Hi Tim:

Thanks for taking the time to help me out with this...



You seem to be flailing around here without any real understanding of what you're trying to connect.  Somehow, you need to tell Apache which requests should be routed to your CherryPy FCGI handler.  I've never set up an FCGI CherryPy script, so I can't give you the recipe, but there certainly are recipes on the web.  You need to UNDERSTAND those recipes, not just blindly copy config files from the web and cross your fingers to hope that they work.


You are absolutely right, i have been flailing around here trying to get this to work. I dont have an understanding of Apache, web server interfacing, fcgi, sockets, ports, or how cherrypy would interface with these in the case of my web host, ie bluehost. Due to this and my assumption that going online after developing the application will be trivial I had false expectations and I set up doing it in the fastest way possible, ie following Glen's wiki:

http://tools.cherrypy.org/wiki/BluehostDeployment

The steps till step 4 are straighforward however there are ambiguities and it does not describe some basic concepts because of which i have been flailing. After my discussions on this thread I am realiszing some things which i share below, please correct me if i am wrong:

1) My setup: My site is located in public_html/subdirectory/. I have a .htaccess in the public and the sub directory and they are identical. I am attaching its contents at the end of this post. I have a cherryd.fcgi file in the cgi-bn directory which is in my public directory. I am attaching this too at the end of this post. My application file (lets say myapp.py is sitting in the public_html/subdirectory.

2) I think i was doing something fundamentally ignorant in my hurry. From putty i was doing python myapp.py. And this would run my app and start up cherrypy. Then i tried to point to http://www.mydomain/subdirectory and instead of the app running i would get a list of files. Is this the right way to do it?  Or should the cherryd.fcgi be calling my application automatically. If this is the case then something is wrong with my cherryd.fcgi file.  I suspect that i am not being able to specify my application correctly in the cherryd file (if this is indeed the way it is to be fired up, rather than me starting it directly on the server via ssh/putty) Any clarification on this would be appreciated.

Below are my .htaccess files and the cherrryd.fcgi file (where i have modified the highlighted line as per Glen's wiki post for bluehost. I also point to the place where i think i should be specifiying my app or the access to it. These are all thoughts and assumptions any reality check would be appreciated.

.htaccess file (sitting in public_html and public_html/subdir where my app is located):
-----------------------
AddHandler fcgid-script .fcgi
#RewriteRule ^(errdoc.cgi(.*))$ /cgi-bin/$1 [last]
#RewriteRule ^(cgi-bin/cherryd.fcgi/.*)$ - [last]
#RewriteRule ^cp/(.*)$ /cgi-bin/cherryd.fcgi/$1 [last]
RewriteRule ^(.*)$ /cgi-bin/cherryd.fcgi/$1 [last]
--------------------------------


cherryd.fcgi (sitting in cgi-bin at the same level as the public_html directory, I have modified the )

--------------------------
!/home2/karunawo/bin/python
"""The CherryPy daemon."""

import sys

import cherrypy
from cherrypy.process import plugins, servers


def start(configfiles=None, daemonize=False, environment=None,
          fastcgi=False, scgi=False, pidfile=None, imports=None):
    """Subscribe all engine plugins and start the engine."""
    sys.path = [''] + sys.path
    for i in imports or []:
        exec "import %s" % i
   
    for c in configfiles or []:
        cherrypy.config.update(c)
   
    engine = cherrypy.engine
   
    if environment is not None:
        cherrypy.config.update({'environment': environment})
   
    # Only daemonize if asked to.
    if daemonize:
        # Don't print anything to stdout/sterr.
        cherrypy.config.update({'log.screen': False})
        plugins.Daemonizer(engine).subscribe()
   
    if pidfile:
        plugins.PIDFile(engine, pidfile).subscribe()
   
    if hasattr(engine, "signal_handler"):
        engine.signal_handler.subscribe()
    if hasattr(engine, "console_control_handler"):
        engine.console_control_handler.subscribe()
   
    if fastcgi and scgi:
        # fastcgi and scgi aren't allowed together.
        cherrypy.log.error("fastcgi and scgi aren't allowed together.", 'ENGINE')
        sys.exit(1)
    elif fastcgi or scgi:
        # Turn off autoreload when using fastcgi or scgi.
        cherrypy.config.update({'engine.autoreload_on': False})
        # Turn off the default HTTP server (which is subscribed by default).
        cherrypy.server.unsubscribe()
       
        addr = cherrypy.server.bind_addr
        if fastcgi:
            f = servers.FlupFCGIServer(application=cherrypy.tree,
                                       bindAddress=addr)
        else:
            f = servers.FlupSCGIServer(application=cherrypy.tree,
                                       bindAddress=addr)
        s = servers.ServerAdapter(engine, httpserver=f, bind_addr=addr)
        s.subscribe()
   
    # Always start the engine; this will start all other services
    try:
        engine.start()
    except:
        # Assume the error has been logged already via bus.log.
        sys.exit(1)
    else:
        engine.block()


if __name__ == '__main__':
    from optparse import OptionParser
   
    p = OptionParser()
    p.add_option('-c', '--config', action="append", dest='config',
                 help="specify config file(s)")
    p.add_option('-d', action="store_true", dest='daemonize',
                 help="run the server as a daemon")
    p.add_option('-e', '--environment', dest='environment', default=None,
                 help="apply the given config environment")
    p.add_option('-f', action="store_true", dest='fastcgi',
                 help="start a fastcgi server instead of the default HTTP server")
    p.add_option('-s', action="store_true", dest='scgi',
                 help="start a scgi server instead of the default HTTP server")
    p.add_option('-i', '--import', action="append", dest='imports',
                 help="specify modules to import")
    p.add_option('-p', '--pidfile', dest='pidfile', default=None,
                 help="store the process id in the given file")
    options, args = p.parse_args()
   
    start( configfiles=["arjunaGlobal.conf"], daemonize=False, fastcgi=True, imports=["/brahmaforces2/arjuna.py"])
-------------------------------------
Glen's wiki on installing cerrypy on bluehost says this about modifying the cherryd.fcgi file

>edit cherryd and put in a hard-coded path to the python you want. Rename cherryd to >/cgi-bin/cherryd.fcgi.

>Thinking that fewer steps are faster, I opted for the latter, and first copied cherryd to >/cgi-bin/cherryd.fcgi, changed the shebang line to /home/myaccount/bin/python, and ripped >out the parameter parsing at the bottom (because Apache isn't going to pass parameters >either).

>I replaced the parameter parsing with one line:

>start( configfiles=["myconfig"], daemonize=False, fastcgi=True, imports=["mycherrysetup"])

Here i am assuming that "myconfig" is my global config file. And "mycherrypysetup" is my cherrypy app. I am trying various paths preceeding "mycherrypysetup".


If this does not work then i should be forced to give up on this wiki and read up in much more detail on Apache, fcgi and making the two work together and then come back to this...Or to evaluate whether all this is necessary (Since I dont know how optimally cherrypy will work with fcgi as opposed to the other methods on bluehost behind Apache) and may just consider switching to another web host that supports cherrypy's more conventional and better documented methods of connecting to Apache.

Will try to debug more today. It seems like a small tweak somewhere would do it...

Thanks for your time and help...


--
Best regards,
arjuna
http://www.brahmaforces.ncom

arjuna

unread,
Mar 22, 2009, 2:56:40 AM3/22/09
to cherryp...@googlegroups.com
I have modified my Cherryd.fcgi file and have attached the modified one below.


If I am to start the application using cherryd, does Apache automatically run cgi-bin/cherryd.fcgi or do i run it explicitly, if so how?

Here is the updated cherryd file:
--------------------
! /home/myaccount/bin/python


"""The CherryPy daemon."""

import sys

import cherrypy
from cherrypy.process import plugins, servers


def start(configfiles=None, daemonize=False, environment=None,
          fastcgi=False, scgi=False, pidfile=None, imports=None):
    """Subscribe all engine plugins and start the engine."""
    sys.path = [''] + sys.path
    for i in imports or []:
        exec "import %s" % i
   
    for c in configfiles or []:
        cherrypy.config.update(c)
        # If there's only one app mounted, merge config into it.
        if len(cherrypy.tree.apps) == 1:
            cherrypy.tree.apps.values()[0].merge(c)
    #from optparse import OptionParser
   
    #p = OptionParser()
    #p.add_option('-c', '--config', action="append", dest='config',
    #             help="specify config file(s)")
    #p.add_option('-d', action="store_true", dest='daemonize',
    #             help="run the server as a daemon")
    #p.add_option('-e', '--environment', dest='environment', default=None,
    #             help="apply the given config environment")
    #p.add_option('-f', action="store_true", dest='fastcgi',
    #             help="start a fastcgi server instead of the default HTTP server")
    #p.add_option('-s', action="store_true", dest='scgi',
    #             help="start a scgi server instead of the default HTTP server")
    #p.add_option('-i', '--import', action="append", dest='imports',
    #             help="specify modules to import")
    #p.add_option('-p', '--pidfile', dest='pidfile', default=None,
    #             help="store the process id in the given file")
    #p.add_option('-P', '--Path', action="append", dest='Path',
    #             help="add the given paths to sys.path")
    #options, args = p.parse_args()
   
    #if options.Path:
    #    for p in options.Path:
    #        sys.path.insert(0, p)
   
    #start(options.config, options.daemonize,
    #      options.environment, options.fastcgi, options.scgi, options.pidfile,
    #      options.imports)

    start( configfiles=["myconfGlobal.conf"], daemonize=False, fastcgi=True, imports=["myapp.py"])
http://www.brahmaforces.com

arjuna

unread,
Mar 22, 2009, 3:07:58 AM3/22/09
to cherryp...@googlegroups.com
At this point:

1) I dont know if apache is running fcgi
2) How to invoke cherryd.fcgi
3) If the configuration on my cherrd.fcgi is correct...

I think that once this is resolved, all of the additional information that may be 2nd nature to the cherrypy/python gurus, needs to be added to the wiki (which i can do, like i created an introduction to cherrypy wiki entry about 1 year ago ( i dont know whether it is still up or where it is)....Because the instruction on how to set this up are in no way clear or straightforward for someone not intimately familiar) and while i am a newbie at all this server stuff, i am a fairly good programmer as the app that i have created will demonstrate when i upload...

On Sun, Mar 22, 2009 at 12:26 PM, arjuna <brahma...@gmail.com> dwrote:

arjuna

unread,
Mar 22, 2009, 3:22:31 AM3/22/09
to cherryp...@googlegroups.com
I have also tried to modify the last line


start( configfiles=["myconfGlobal.conf"], daemonize=False, fastcgi=True, imports=["myapp.py"])

as

start( configfiles=["../subdirectory/myconfGlobal.conf"], daemonize=False, fastcgi=True, imports=["../subdirectory/myapp.py"])

thus providing relative paths from cgi-bin to the subdirectory where the conf file and my app sits

but i dont think that apache is invoking cherryd....

arjuna

unread,
Mar 22, 2009, 5:13:11 AM3/22/09
to cherryp...@googlegroups.com
Here is some progress to report and some questions:

I talked to Bluehost about 1) is fastcgi running on apache 2) why is my cherryd file not running. I t turns about there were several problems the first being a wrong path to python on the shebang line, then a python error, finally he taught me how to call the cherryd.fcgi file from the cgi-bin using ssh (./cherryd.fcgi) and lo and behold cherryd ran and gave me some errors.

1) Since my application is in a directory other than cgi-bin cherryd could not find it and import it. How do i get cherryd to import myapp.py sitting in a different directory?

2) I copied my app files and global and app specific conf files to the cgi-bin folder for testing. I fired up cherryd. It started the server giving me all the depreciation warnings. Then it said

Serving on karunaworks.com:2000

 But in a few seconds it stopped it giving me the old

IO error: port 2000 not free on karunaworks.com.


Obviously my global.conf file is setup wrong. It is as follows:

[global]
server.socket_host = "karunaworks.com"
server.socket_port = 2000
server.thread_pool = 10

# remove any limit on the request body size; cherrypy's default is 100MB
# (maybe we should just increase it ?)
server.max_request_body_size = 0

# increase server socket timeout to 60s; we are more tolerant of bad
# quality client-server connections (cherrypy's defult is 10s)
server.socket_timeout = 60


What should the socket_host and port be set to? Because I am not trying to serve cherrypy on karunaworks.com but to Apache, so i need an address that apache will accept?Apache will handle serving it on the domain.

Also how do i get cherryd to import myapp when it is sitting in another directory from cgi-bin?

Thanks in advance...

arjuna

unread,
Mar 22, 2009, 6:18:38 AM3/22/09
to cherryp...@googlegroups.com
Do i even need to deploy behind apache, can i not simply serve using cherrypy online as a separate web server?

Sylvain Hellegouarch

unread,
Mar 22, 2009, 6:39:35 AM3/22/09
to cherryp...@googlegroups.com
arjuna a écrit :

> Do i even need to deploy behind apache, can i not simply serve using
> cherrypy online as a separate web server?
You ask so many questions it's hard to even keep track ;)

The short answer is: no. You don't need Apache nor any other web server.
CherryPy can do that job just fine.

The long answer is that it depends on what you're serving. There are
places where having a frontend HTTP server makes sense. For instance
lighttpd is much faster for static content.

- Sylvain

arjuna

unread,
Mar 22, 2009, 8:04:07 AM3/22/09
to cherryp...@googlegroups.com
Hi Sylvain:
 
Sorry about asking so many questions... I am just trying to get my app that i have been developing over a long time on the internet and it is not happening...While i am a good programmer i dont have a lot of knowledge about apache, web servers...And i am trying to figure out the best way to get my cherrypy app online. My current web host is bluehost...

Sylvain Hellegouarch

unread,
Mar 22, 2009, 8:07:46 AM3/22/09
to cherryp...@googlegroups.com
arjuna a écrit :

> Hi Sylvain:
>
> Sorry about asking so many questions... I am just trying to get my app
> that i have been developing over a long time on the internet and it is
> not happening...While i am a good programmer i dont have a lot of
> knowledge about apache, web servers...And i am trying to figure out
> the best way to get my cherrypy app online. My current web host is
> bluehost...

I wasn't trying to be mean ;)

I've found in the past that using mod_rewrite was the easiest path if
you could have the CP server up as a long running process.

I've never used FCGI and I can't easily help you here.

- Sylvain

arjuna

unread,
Mar 24, 2009, 2:45:52 AM3/24/09
to cherryp...@googlegroups.com
Hi All:
 
I just found out from Bluehost that Bluehost DOES support Mod-rewrite.
 
Glens wiki says:
Bluehost provides shared hosting, on Linux/Apache. The standard configuration only permits what Apache calls "dynamic server" FCGI, which appears to be the one in the FCGI spec. The others, static and external, seem to be extensions to the spec, that do have some nice properties, but are not supported at BluehostBluehost provides shared hosting, on Linux/Apache. The standard configuration only permits what Apache calls "dynamic server" FCGI, which appears to be the one in the FCGI spec. The others, static and external, seem to be extensions to the spec, that do have some nice properties, but are not supported at Bluehost
 
Since Bluehost supports ModWrite and that seems to be a more straightforward install im going to try going the ModRewrite route rather than FCGI.

Glenn Linderman

unread,
Apr 22, 2009, 5:40:02 AM4/22/09
to cherryp...@googlegroups.com
On approximately 3/21/2009 11:09 PM, came the following characters from
the keyboard of arjuna:


I haven't looked at how the 3.1.2 release has the above line, but I
changed it to drop the 2nd parameter. That was key in working around
some bug, I think. But I think the real fix would be different.

(Going through the 55 messages quick, and then off to bed)


> else:
> f = servers.FlupSCGIServer(application=cherrypy.tree,
> bindAddress=addr)


--
Glenn -- http://nevcal.com/
===========================
A protocol is complete when there is nothing left to remove.
-- Stuart Cheshire, Apple Computer, regarding Zero Configuration Networking

Glenn Linderman

unread,
Apr 22, 2009, 5:41:37 AM4/22/09
to cherryp...@googlegroups.com
On approximately 3/21/2009 11:56 PM, came the following characters from
the keyboard of arjuna:

> I have modified my Cherryd.fcgi file and have attached the modified one
> below.
>
>
> If I am to start the application using cherryd, does Apache
> automatically run cgi-bin/cherryd.fcgi or do i run it explicitly, if so how?


Apache starts it if needed (if it isn't already running) when you give
URL that includes http://yourdomain.com/cgi-bin/cherryd.fcgi/....

Glenn Linderman

unread,
Apr 22, 2009, 5:44:30 AM4/22/09
to cherryp...@googlegroups.com
On approximately 3/22/2009 3:18 AM, came the following characters from
the keyboard of arjuna:

> Do i even need to deploy behind apache, can i not simply serve using
> cherrypy online as a separate web server?

I wish. On a particular machine, port 80 can only be owned by one
process. Most hosting companies give that port to Apache, or their
preferred web server. Bluehost gives it to Apache. No one else can use
it. And they block all the other ports too. So for bluehost, must be
behind Apache, and must be FCGI

Glenn Linderman

unread,
Apr 22, 2009, 5:45:50 AM4/22/09
to cherryp...@googlegroups.com
On approximately 3/23/2009 11:45 PM, came the following characters from
the keyboard of arjuna:

> Hi All:
>
> I just found out from Bluehost that Bluehost DOES support Mod-rewrite.
>
> Glens wiki says:
> Bluehost provides shared hosting, on Linux/Apache. The standard
> configuration only permits what Apache calls "dynamic server" FCGI,
> which appears to be the one in the FCGI spec. The others, static and
> external, seem to be extensions to the spec, that do have some nice
> properties, but are not supported at BluehostBluehost provides shared
> hosting, on Linux/Apache. The standard configuration only permits what
> Apache calls "dynamic server" FCGI, which appears to be the one in the
> FCGI spec. The others, static and external, seem to be extensions to the
> spec, that do have some nice properties, but are not supported at Bluehost
>
> Since Bluehost supports ModWrite and that seems to be a more
> straightforward install im going to try going the ModRewrite route
> rather than FCGI.


But mod_rewrite won't start your CherryPy process. FCGI will, and is
the only solution Bluehost provides that will.

Glenn Linderman

unread,
Apr 22, 2009, 5:59:26 AM4/22/09
to cherryp...@googlegroups.com
On approximately 3/15/2009 5:23 AM, came the following characters from
the keyboard of brahmaforces:
> Hi Glen:
>
> Despite the delay, (got busy with some paid consulting...which always
> helps specially in times of recession) I am back to my cherrypy
> app...:) Ok so where were we..
>
> 1) I had to put in the two patches 1) to make cp play well with python
> 2.6 2) to make it play with apache. Following your instructions I
> simply downloaded the files from the the links you posted on the wiki
> (listed earlier in this post) and ftped them up to the server. So i am
> assuming they are now in effect.
>
> 2) I did step 4 and copied your lines into the htaccess file which i
> put in the public html directory
>
> 3) on step 5 like you i am going for the Option C which seems the
> simplest. However here is my question:
>
> You say:
> --------------------------
> C) edit cherryd and put in a hard-coded path to the python you want.

> Rename cherryd to /cgi-bin/cherryd.fcgi.
>
> Thinking that fewer steps are faster, I opted for the latter, and
> first copied cherryd to /cgi-bin/cherryd.fcgi, changed the shebang
> line to /home/myaccount/bin/python, and ripped out the parameter
> parsing at the bottom (because Apache isn't going to pass parameters
> either).
>
> I replaced the parameter parsing with one line:
>
> start( configfiles=["myconfig"], daemonize=False,
> fastcgi=True, imports=["mycherrysetup"])
>
> ----------------------------
> question 1) There are 2 configuration files in cherrypy 1) the global
> one 2) one specific to my app...Which one does "myconfig" refer to


The global one. The local one(s) is/are specified within the global
configuration, as far as I know, if they are needed. I'm actually not
using configuration files, but instead configuration dictionaries built
in code.


>
> question 2) What is "mycherrypysetup"


The cherrypy application code.


>
> question 3) Doing a "whereis python" on bluehost via ssh i get many
> paths to python2.6 which one should i use?/


Dunno. I installed my own, and am using it. Any python2.6 should work,
I suppose, as long as you can convince it to look at your locally
installed CherryPy packages.


> question 4) At what point do i uncomment the last line in htaccess and
> how do i test my cherrypy app


The other order. Get the app working first, then the last line gets
uncommented to expose the shorter URLs to the users.


>
> question 5) My global conf file is as follows:
>
> [global]
> server.socket_host = "localhost"
> server.socket_port = 8080


> server.thread_pool = 10
>
> # remove any limit on the request body size; cherrypy's default is
> 100MB
> # (maybe we should just increase it ?)
> server.max_request_body_size = 0
>
> # increase server socket timeout to 60s; we are more tolerant of bad
> # quality client-server connections (cherrypy's defult is 10s)
> server.socket_timeout = 60
>
>

> Do i need to change the localhost to something else on the bluehost
> server?


You don't need a sock or host when using FCGI


> Thanks in advance...A bit of friendly feedback for your wiki post.
> While everything upto point 4 is self explanatory (except how to
> install patches which you clarified in your post) Point 5 needs
> clarification along the above dimensions. (in the spirit of making
> your post even more helpful)
>
> Thanks...


Sorry for the delay. I've been busy. Seems I'm the only one that knows
anything about bluehost and cherrypy around here. I didn't mean to
become the expert, just wanted to get my application working...

Glenn Linderman

unread,
Apr 22, 2009, 6:08:01 AM4/22/09
to cherryp...@googlegroups.com
On approximately 3/15/2009 5:34 AM, came the following characters from
the keyboard of brahmaforces:
> After making all the changes in the wiki how do i startup the site? on
> the localhost we simply go:
>
> http://localhost:8080/
>
> and away we go...what do i do on my bluehost...


Access a URL that references the FCGI file.
http://yourdomain.com/cgi-bin/cherryd.fcgi/parameters/for/your/CherryPy/application

and Apache FCGI will start the FCGI and pass it the rest of the URL.

> Also i am not clear about the subdomains
> I have a main domain and a subdomain. I have made the changes to the
> public html (htaccess and cgi bin) for the main domain. I assume this
> will mean that this will inherit down the subdomain and cherrypy will
> process the subdomain. But what of the other subdomains? Will they run
> naturally or will cherrypy try to run them?


I do subdomains differently that most cPanel users, by Parking them like
regular domains, and then tweaking my .htaccess to make them see
different things. So I know that all my subdomains will see the
.htaccess file and be affected equivalently. Not sure about the regular
subdomains.

CherryPy will only be invoked in the URL contains /cgi-bin/cherryd.fcgi/

The .htaccess rules I showed, the last one in particular (which is
commented out) adds the /cgi-bin/cherryd.fcgi/ URL fragment to all
incoming URLs that get that far (aren't handled above). So you can
tweak the rewrite rules to your heart's content, and achieve any
combination of things being handled by CherryPy or not.

If your subdomain sees the top level .htaccess and its rewrite rules,
and is affected by them, then it will try to run CherryPy. If you don't
want that tweak the rewrite rules.

If your subdomain doesn't see the top .htaccess, and you do want it
handled by CherryPy (and the regular subdomain even has its own cgi-bin
if I recall correctly), then you might have to clone and tweak the
.htaccess into the subdomain area, and possibly also the cherryd.fcgi file.

If you get the main domain working with CherryPy, these comments should
be enough to help you get the subdomains working with it, or not, as
desired.

I'm not going to start classes in mod_rewrite, though. There is lots of
documentation for that floating around. So just start from my rules,
and tweak according to the documentation and your goals.


>
> Thanks again

Glenn Linderman

unread,
Apr 22, 2009, 6:09:18 AM4/22/09
to cherryp...@googlegroups.com
On approximately 3/15/2009 5:39 AM, came the following characters from
the keyboard of brahmaforces:
> When I try to point the browser to the path where the cherrypy files
> are stored it simply lists the contents of the directory and then
> says:
>
> Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8i DAV/2
> mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
> mod_rbl1.0 Server at www.karunaworks.com Port 80
>
> Is cherrypy running?

Can't tell from this. What URL did you send?

Glenn Linderman

unread,
Apr 22, 2009, 6:10:31 AM4/22/09
to cherryp...@googlegroups.com
On approximately 3/15/2009 6:29 AM, came the following characters from
the keyboard of arjuna:
> When I run my app going to the right directory, using ssh typing python
> myappname.py it runs but it says
>
> no module named MySQLdb
>
> I understand that this particular module has path issues related to
> mysql, any experience regarding where mysql sits on bluehost or how to
> get MySQLdb to run on bluehost?


I think mysql runs on bluehost, but I don't use it.

Glenn Linderman

unread,
Apr 22, 2009, 6:12:01 AM4/22/09
to cherryp...@googlegroups.com
On approximately 3/15/2009 7:45 AM, came the following characters from
the keyboard of arjuna:
> For the record and other simpletonts like me that may follow in
> migrating their cherrypy app to the server specifically to bluehost:
>
> 1) The modules like MySQLdb and other module that the python code
> imports is simply installed. I have a src directory in my root
> folder/home(on my bluehost account) Here I upload the tar.gz files and
> simply unpack them and run the appropriate setup commands (python
> setup.py install and so on) I now have all my packages installed.
>
> 2) It also seems to be trying to run cherrypy when i type python
> myappname.py
>
> However I figure i have some tuning to do as i am now getting the
> following error:
>
> a) A whole bunch of Depreciation warnings (for md5, sha, mysql db) any
> ideas on how to get rid of these?


This is a pure python question, better asked elsewhere, but the answer is

import warnings
warnings.simplefilter("ignore", DeprecationWarning )


> b) It starts the engine but tries to serve it on localhost:8080 (guess i
> have to tinker with my config file)

Yep.

Glenn Linderman

unread,
Apr 22, 2009, 6:15:28 AM4/22/09
to cherryp...@googlegroups.com
On approximately 3/19/2009 8:28 AM, came the following characters from
the keyboard of arjuna:
> ALRIGHT!!! We have lift off!!! Cherrypy has started online!!! Thanks
> all, will post my site as soon as i clean up the design a bit in the
> next few days!!!!Wow!


I think this is the one that convinced me that you had it working, and
that I just needed to clean up the documentation when I had time...

Glenn Linderman

unread,
Apr 22, 2009, 6:18:23 AM4/22/09
to cherryp...@googlegroups.com
On approximately 3/19/2009 1:43 PM, came the following characters from
the keyboard of Robert Brewer:

> arjuna wrote:
>> It says serving on mydomain:2000
>> however when i go to http://www.mydomain:2000
>> it says connecting.... and nothing happens
>> (unlike the magic that happens on my localhost)
>
> If that 'serving on...' message is spit out by CherryPy, then you
> certainly do *not* want that port to be accessible to the outside world.
> That is the port which CherryPy is listening on for FastCGI messages
> from Apache on the same machine; it is NOT an HTTP port.
>
> -----\ ---------\ -----------
> | CP 2000 <-FastCGI-> | Apache 80 <-HTTP-> | Browser |
> -----/ ---------/ -----------


FastCGI messages come in on a socket established when the FastCGI
process is launched. So there is not port involved for FastCGI, as far
as I know. Or do I misunderstand something?

arjuna

unread,
Apr 22, 2009, 6:29:06 AM4/22/09
to cherryp...@googlegroups.com
Glen:
 
Thanks again for all the replies...This gives me a lot to go on...I will explore this fully and when i get it working will definately give you detailed feedback for the wiki...I already see some very basic things i was doing wrong...Will get back soon after working on it for some time...Thanks again...

Robert Brewer

unread,
Apr 23, 2009, 4:29:17 AM4/23/09
to cherryp...@googlegroups.com
Glenn Linderman wrote:
> On approximately 3/19/2009 1:43 PM, came the following characters from
> the keyboard of Robert Brewer:
> > arjuna wrote:
> >> It says serving on mydomain:2000
> >> however when i go to http://www.mydomain:2000
> >> it says connecting.... and nothing happens
> >> (unlike the magic that happens on my localhost)
> >
> > If that 'serving on...' message is spit out by CherryPy, then you
> > certainly do *not* want that port to be accessible to the outside
> world.
> > That is the port which CherryPy is listening on for FastCGI messages
> > from Apache on the same machine; it is NOT an HTTP port.
> >
> > -----\ ---------\ -----------
> > | CP 2000 <-FastCGI-> | Apache 80 <-HTTP-> | Browser |
> > -----/ ---------/ -----------
>
>
> FastCGI messages come in on a socket established when the FastCGI
> process is launched. So there is not port involved for FastCGI, as
far
> as I know. Or do I misunderstand something?

If it's a TCP socket, then it has a port. If it's a Unix socket, then it
has a pseudo-file instead.


Bob

Glenn Linderman

unread,
Apr 23, 2009, 6:29:40 AM4/23/09
to cherryp...@googlegroups.com
On approximately 4/23/2009 1:29 AM, came the following characters from


OK, well I don't know which it is, or maybe it is a pipe. I guess my
real point was that one doesn't need to configure a port when using
FastCGI... the I/O technique is already established when CherryPy
launches. So that's what I should have said.

Reply all
Reply to author
Forward
0 new messages