473,231 Members | 1,477 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

Cherrypy setup questions

Hello,

I'd like to start trying out some cherrypy apps, but I've been having some setup
problems. I think I need some bone-head simple example to clear my understanding. :)

I'm on a system running Apache, that I don't have root access to. I will be
publishing the html/image/python files in a directory off of my current web page, and
running the app as a user on the system. I'd like to be able to specify the base url
for the app, especially if I have more than one app. I've read the docs, but am
getting confused with the config file information, and exactly how to set it up. I'm
using CherryPy 3.0.1, the latest I know.

Some questions I have:
1) can I configure cherrypy to look at requests only off a base url, like:

http://www.provider.com:8080/~myusername/apps

and ignore all other requests below that url, like

http://www.provider.com:8080/~someotherguy

or

http://www.provider.com:8080/~myusername
2) If you run (as in Unix):

cd app1
python mycherrypyapp1.py &

cd ../app2
python mycherrypyapp2.py &
Does this start 2 cherrypy servers, trying to both fight for port 8080, or is there
only one, and the two apps share it?
Are there any examples that show such a setup? I didn't see a CherryPy mailing list,
so I'm posting here, but if there is somewhere else better I'd be glad to know!


thanks,
Brian Blais
--
-----------------

bb****@bryant.edu
http://web.bryant.edu/~bblais
May 23 '07 #1
2 7610
On May 22, 6:38 pm, Brian Blais <bbl...@bryant.eduwrote:
I'd like to start trying out some cherrypy apps, but I've
been having some setup problems. I think I need some
bone-head simple example to clear my understanding. :)

I'm on a system running Apache, that I don't have root
access to. I will be publishing the html/image/python
files in a directory off of my current web page, and
running the app as a user on the system. I'd like to be
able to specify the base url for the app, especially if
I have more than one app. I've read the docs, but am
getting confused with the config file information, and
exactly how to set it up. I'm using CherryPy 3.0.1,
the latest I know.

Some questions I have:
1) can I configure cherrypy to look at requests only
off a base url, like:

http://www.provider.com:8080/~myusername/apps
Yes, you can. Assuming you're using the "cherrypy.quickstart"
function, supply the "base url" in the "script_name" argument; for
example:

sn = 'http://www.provider.com:8080/~myusername/apps'
cherrypy.quickstart(Root(), sn, config)

If you're using cherrypy.tree.mount instead of quickstart, it takes a
similar argument.
2) If you run (as in Unix):

cd app1
python mycherrypyapp1.py &

cd ../app2
python mycherrypyapp2.py &

Does this start 2 cherrypy servers, trying to both fight
for port 8080, or is there only one, and the two apps share it?
This will almost certainly start two cherrypy servers. You can run one
on a different port via a "server.socket_port" config entry if you
like. If you want them both to run on the same port but different
"base urls", you should write a small "mysite.py" which mounts them as
desired; for example:

# mysite.py

import cherrypy
import app1, app2

cherrypy.tree.mount(app1.root, "/app1")
cherrypy.tree.mount(app2.root, "/app2")
cherrypy.server.quickstart()
cherrypy.engine.start()
cherrypy.engine.block()

I didn't see a CherryPy mailing list, so I'm posting here,
but if there is somewhere else better I'd be glad to know!
There is a cherrypy-users mailing list, and I'm CC'ing it so you can
reply there if you like. :)

Hope that helps!
Robert Brewer
System Architect
Amor Ministries
fu******@amor.org

May 23 '07 #2
fumanchu wrote:
On May 22, 6:38 pm, Brian Blais <bbl...@bryant.eduwrote:
>I'd like to start trying out some cherrypy apps, but I've
been having some setup problems. I think I need some
bone-head simple example to clear my understanding. :)
1) can I configure cherrypy to look at requests only
off a base url, like:

http://www.provider.com:8080/~myusername/apps

Yes, you can. Assuming you're using the "cherrypy.quickstart"
function, supply the "base url" in the "script_name" argument; for
example:

sn = 'http://www.provider.com:8080/~myusername/apps'
cherrypy.quickstart(Root(), sn, config)
Thanks for your reply, but for some reason it is not working as stated. I'm probably
missing something.

import cherrypy
from cherrypy import expose

class HelloWorld:
@expose
def hello(self,*another):
if not another:
return("hello")
else:
return("hello: %s" % str(another))
@expose
def index(self):
return "Hello world!"
# at first I tried
cherrypy.quickstart(HelloWorld())

which works, off of http://localhost:8080/

and http://localhost:8080/hello
and http://localhost:8080/hello/more_stuff

works fine.

# so then I tried each of these (separately, of course)...
baseurl='http://localhost:8080/~bblais/apps'
cherrypy.quickstart(HelloWorld(),baseurl)

# then
baseurl='http://localhost:8080/bblais/apps'
cherrypy.quickstart(HelloWorld(),baseurl)
# finally,
root=HelloWorld()
cherrypy.tree.mount(root,'apps/')
cherrypy.server.quickstart()
cherrypy.engine.start()
cherrypy.engine.block()
In each case, there is similar behavior. The script runs fine, and the Cherrypy
gives the usual startup message, but nothing is printed when I access the above urls.
I know something is wrong, because cherrypy doesn't even log the events. Without
the baseurl specified, I get things like:

127.0.0.1 - - [23/May/2007:08:56:24] "GET /hello HTTP/1.1" 200 5 "" ""

whenever I access the site. Specifying the baseurl, nothing.

Two more pieces of info. When I start, I usually get:

The Application mounted at '' has an empty config.

which is solved by adding a config='hello.conf', where hello.conf is:

[global]
server.socket_host = "localhost"
server.socket_port = 8080
server.thread_pool = 10
even with that, I when I specify a baseurl (say, apps), I get:

The Application mounted at 'apps' has an empty config.
Is it missing something, that it can't make a default choice on?

thanks for your help!
Brian Blais
--
-----------------

bb****@bryant.edu
http://web.bryant.edu/~bblais

May 23 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Remi Delon | last post by:
Hello everyone, I am pleased to announce the release of CherryPy-10. It's been a while since I last announced a CherryPy release on this newsgroup but a lot has happened since then: - The...
13
by: Charlotte | last post by:
I am developing a web application and am looking for the best framework to do this in. I know this is an old question, and I have read the list archives and a couple of comparison pages on the web....
2
by: mep | last post by:
Hi, After lookup in cherrypy site and google for a while, I haven't found any information about cherrypy how to serve dynamic binary file(some generated charts).Is there any easy way to do this?...
0
by: infidel | last post by:
I have just recently discovered CherryPy and Kid (many kudos to the respective developers!) and am tinkering with them to see what I can come up with. The application I eventually want to write...
1
by: infidel | last post by:
I did an "svn update" of cherrypy this morning, and now when I try running a server, the log window just keeps reporting the autoreloader restarting over and over: 2005/10/19 12:42:33 HTTP INFO...
2
by: infidel | last post by:
I've been trying to get my CherryPy server to authenticate users against our network. I've managed to cobble together a simple function that uses our LDAP server to validate the username and...
0
by: Thomas McLean | last post by:
Hi all, First post to the list, so first off, I'm new to Python and everything surrounding it so if you can please ignore my ignorance. I setup a cherryPY server so that I could use sabnzbd...
10
by: Vincent Delporte | last post by:
Hi I'm still a newbie when it comes to web applications, so would like some help in choosing a solution to write apps with Python: What's the difference between using running it through...
3
by: Brian Blais | last post by:
Hello, I have more of a conceptual question about the way databases work, in a web framework, but I will be implementing things with CherryPy and SQLAlchemy. If you make a web form that adds...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.