Use CherryPy's statistics feature with Flask

39 views
Skip to first unread message

Hồng Quân Nguyễn

unread,
Nov 19, 2013, 10:55:41 PM11/19/13
to cherryp...@googlegroups.com
Hi

I'm using CherryPy's WSGI server to run my Flask app. I want to use CherryPy's statistics feature. Here is how I setup:


('/' is my Flask app location, '/stat/' is for Report page)

But when I access to /stat/, I get this error:


Please tell me what should I do.

anh le

unread,
Dec 4, 2013, 2:53:31 AM12/4/13
to cherryp...@googlegroups.com
Hi Quân,

I do the config to turn on cpstats tool differently and it works:

- d = wsgiserver.WSGIPathInfoDispatcher({'/': app, '/stat': cherryapp})
+ d = wsgiserver.WSGIPathInfoDispatcher({'/': app, '/stat': cherryapp,
{'/stat': {'tools.cpstats.on': True}})
> --
> 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-user...@googlegroups.com.
> To post to this group, send email to cherryp...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cherrypy-users.
> For more options, visit https://groups.google.com/groups/opt_out.

Nguyễn Hồng Quân

unread,
Dec 5, 2013, 1:01:14 PM12/5/13
to cherryp...@googlegroups.com
Hi

2013/12/4 anh le <anh...@gmail.com>

Hi Quân,

I do the config to turn on cpstats tool differently and it works:

-  d = wsgiserver.WSGIPathInfoDispatcher({'/': app, '/stat': cherryapp})
+ d = wsgiserver.WSGIPathInfoDispatcher({'/': app, '/stat': cherryapp,
{'/stat': {'tools.cpstats.on': True}})

Do you mean to put
```
{'/stat': {'tools.cpstats.on': True}}
```

into the line
```
cherryapp = cherrypy.tree.mount(StatsPage(), '/stat')
```
?

Unfortunately, my side doesn't work, because I'm running Python 3, and this module of CherryPy is not ported completely to Python 3 yet.

--
***********************************************
* Nguyễn Hồng Quân                            *
* Y!M: ng_hquan_vn                            *
* Identi.ca: hongquan                         *
***********************************************

anh le

unread,
Dec 5, 2013, 8:41:31 PM12/5/13
to cherryp...@googlegroups.com
On Fri, Dec 6, 2013 at 1:01 AM, Nguyễn Hồng Quân <ng.hon...@gmail.com> wrote:
> Hi
>
> 2013/12/4 anh le <anh...@gmail.com>
>>
>> Hi Quân,
>>
>> I do the config to turn on cpstats tool differently and it works:
>>
>> - d = wsgiserver.WSGIPathInfoDispatcher({'/': app, '/stat': cherryapp})
>> + d = wsgiserver.WSGIPathInfoDispatcher({'/': app, '/stat': cherryapp,
>> {'/stat': {'tools.cpstats.on': True}})
>
>
> Do you mean to put
> ```
> {'/stat': {'tools.cpstats.on': True}}
> ```
>
> into the line
> ```
> cherryapp = cherrypy.tree.mount(StatsPage(), '/stat')
> ```
> ?
>
> Unfortunately, my side doesn't work, because I'm running Python 3, and this
> module of CherryPy is not ported completely to Python 3 yet.

Sorry for the incorrect diff, it should read:
cherryapp = cherrypy.tree.mount(StatsPage(), '/stat', {'/stat':
{'tools.cpstats.on':True}})
d = wsgiserver.WSGIPathInfoDispatcher({'/': app, '/stat': cherryapp})

However as you point out that won't work for Python 3, I forgot to
check the version.
Reply all
Reply to author
Forward
0 new messages