Setup Differnt Port for CherryPy

Will Addison <[email protected]>
Newsgroups gmane.comp.python.cherrypy
Message-ID <[email protected]>
Hello, 

I am having trouble with setting CherryPy to a different port. I'm new to 
Python and CherryPy. I purchased a book called Python 3 Web Development and 
I've been trying to go by that but I'm lost. Currently Port 8080 is being 
used by something else in the book it says you can change the port but it 
doesn't explain that well how to do that or where to do that. Can someone 
help me? 

This is the original code for the exercise. 
import cherrypy
import os.path
current_dir = os.path.dirname(os.path.abspath(__file__))
class Root(object):
 
 content = '''<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "
http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<link rel="stylesheet" 
href="static/css/smoothness/jquery-ui-1.8.4.custom.css" type="text/css" 
media="screen, projection" />
<script type="text/javascript" src="static/jquery-1.4.2.js" ></script>
<script type="text/javascript" src="static/jquery-ui-1.8.4.custom.min.js" 
></script>
</head>
<body id="spreadsheet_example">
<div id="example">
 an empty div
</div>
</body>
</html>
 '''
 
 @cherrypy.expose
 def index(self):
  return Root.content
 
if __name__ == "__main__":
 
 cherrypy.quickstart(Root(),config={
  '/static':
  { 'tools.staticdir.on':True,
    'tools.staticdir.dir':current_dir+"/static"
  }
 })

The book says the following and this is where I'm confused.

If we would like CherryPy to listen on a different port, we should indicate 
this in

the global configuration. This can be done by preceding the call to 
cherrypy.

quickstart() with cherrypy.config.update({'server.socket_

port':8088}). CherryPy has a rich palette of configuration options and can

even be instructed to read its configuration from files. A good starting 
point for

all the possibilities is http://www.cherrypy.org/wiki/ConfigAPI.

-- 
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cherrypy-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To post to this group, send email to cherrypy-users-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.