List Info

Thread: running app as package




running app as package
user name
2006-11-02 18:27:52
Running CherryPy 3.0.0beta2 on Python 2.4.3 on Windows XP.

Created following "hello" package in sys.path:

D:devpythonhello> cat  __init__.py
import cherrypy
class HelloWorld:
    cherrypy.expose
    def index(self):
        return "Hello world!"
cherrypy.tree.mount(HelloWorld())
cherrypy.server.quickstart()
cherrypy.engine.start()

D:devpythonhello> ls -l
drwx------+ 2   0 Nov  2 12:21 .
d---------+ 6   0 Nov  2 10:28 ..
-rwx------  1 278 Nov  2 12:21 __init__.py
-rwx------  1 211 Nov  2 12:21 __init__.pyc

It runs fine executed as a module:

D:devpythonhello> python  __init__.py
[02/Nov/2006:12:56:32] HTTP Serving HTTP on http://localhost:8080/
127.0.0.1 - - [02/Nov/2006:12:56:37] "GET /favicon.ico
HTTP/1.1" 404
1200 "" "Mozilla/5.0 (Windows; U; Windows NT
5.1; en-US; rv:1.8.0.7)
Gecko/200609
09 Firefox/1.5.0.7"
127.0.0.1 - - [02/Nov/2006:12:56:39] "GET /
HTTP/1.1" 200 12 ""
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.8.0.7)
Gecko/20060909 Firefox/1.
5.0.7"
[02/Nov/2006:12:56:45] ENGINE <Ctrl-C> hit: shutting
down app engine
[02/Nov/2006:12:56:50] HTTP HTTP Server shut down
[02/Nov/2006:12:56:50] ENGINE CherryPy shut down

But running as a package (D:devpython is in sys.path)
there is no
response on 8080 and Ctrl-C causes console window to lockup
while
shutting down app engine:

D:devpythonhello> python -c "import hello"
[02/Nov/2006:12:58:13] HTTP Serving HTTP on http://localhost:8080/
[02/Nov/2006:12:58:56] ENGINE <Ctrl-C> hit: shutting
down app engine

Are there any caveats to package structuring a CherryPy app?
Thanks.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at ht
tp://groups-beta.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

running app as package
user name
2006-11-02 19:05:39
On 11/2/06, stburns < gstburnsgmail.com">gstburnsgmail.com> wrote:

D:devpythonhello> python -c "import hello";
[02/Nov/2006:12:58:13] HTTP Serving HTTP on http://localhost:8080/
[02/Nov/2006:12:58:56] ENGINE <Ctrl-C> hit: shutting down app engine

Are there any caveats to package structuring a CherryPy app?

Robert certainly showed you the right way.  I have never seen a Python app started with a call to python -c "import whatever&quot;. 

When I first read this, I thought that you were trying to run your app and interact with it in the interpreter.  But after rereading your message, I'm not so sure. ; In case you are, here's the "magic":

cherrypy.server.quickstart()
cherrypy.engine.start(blocking=False)

and then...

python -i __init__.py

Christian
http://www.dowski.com



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users&quot; group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )