记录器“stomp.py”找不到处理程序

时间:2011-05-28 03:30:39

标签: django handler stomp orbited

我正试图按照http://mischneider.net/?p=125

上的说明运行Orbited

以下是错误的副本:

Validating models...

0 errors found
Django version 1.3, using settings 'comet.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[28/May/2011 11:43:36] "GET /comet/ HTTP/1.1" 200 2952
[28/May/2011 11:43:36] "GET /site_media/Orbited.js HTTP/1.1" 304 0
[28/May/2011 11:43:37] "GET /site_media/stomp.js HTTP/1.1" 304 0
[28/May/2011 11:44:18] "POST /addMessage/ HTTP/1.1" 403 2332
[28/May/2011 11:44:21] "POST /addMessage/ HTTP/1.1" 403 2332
[28/May/2011 11:44:40] "GET /comet/ HTTP/1.1" 200 2952
[28/May/2011 11:44:41] "GET /site_media/Orbited.js HTTP/1.1" 304 0
[28/May/2011 11:44:41] "GET /site_media/stomp.js HTTP/1.1" 304 0
No handlers could be found for logger "stomp.py"
[28/May/2011 12:00:36] "GET /comet/ HTTP/1.1" 200 2952

另外,当我加载页面时,它给了我一个错误。这是我的一些文件的选择。

的index.html:

<html>
<head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <title>Django, Orbited, Stomp and Co.</title>
    <script src="http://www.json.org/json2.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
    <script src="/site_media/Orbited.js"></script>
    <script>
    // set the orbited settings and port
    Orbited.settings.port = 9000;
    Orbited.settings.hostname = "127.0.0.1";
    //Orbited.settings.streaming = false;
    TCPSocket = Orbited.TCPSocket
    </script>
    <script> document.domain = document.domain; </script>
    <script src="/site_media/stomp.js"></script>

    <script type="text/javascript" charset="utf-8">

        function add_message(msg) {
            $("<p>" + msg["user"] + ": " + msg["message"] + " at " + msg["time"] + "</p>").appendTo("#messages")
        };
        $(document).ready(function() {
            stomp = new STOMPClient();
            stomp.onopen = function(){
                //console.log("opening stomp client");
            };
            stomp.onclose = function(c){
                alert('Lost Connection, Code: ' + c);
            };
            stomp.onerror = function(error){
                alert("Error: " + error);
            };
            stomp.onerrorframe = function(frame){
                alert("Error: " + frame.body);
            };
            stomp.onconnectedframe = function(){
                console.log("Connected. Subscribing");
                //alert("subscribing");
                stomp.subscribe("/messages");
            };
            stomp.onmessageframe = function(frame){
                // Presumably we should only receive message frames with the
                // destination "/topic/message" because that's the only destination
                // to which we've subscribed. To handle multiple destinations we
                // would have to check frame.headers.destination.
                add_message(JSON.parse(frame.body));
            };
            stomp.connect('localhost', 61613);

            $("#send").click(function(data) {
                var message = $("#message").val()
                var user = $("#user").val()
                $.post("/addMessage/", {"message":message, "user":user});
            })
        });

    </script>
</head>
<body id="index">
    <div id="messages">
        {% for message in messages %}
            <p>{{message.user}}: {{message.body}} at {{message.time|date:"H:i-d/m/Y"}}</p>
        {% endfor %}
    </div>
    <div id="new_message">
        Text: <input type="text" name="message" value="" id="message">  Name: <input type="text" name="user" value="" id="user">
        <p><button type="text" id="send" value="Submit a message">Submit a message</button><p>
    </div>

</body>

orbited.cnf

[listen]
http://:9000
stomp://:61613

[access]
* -> localhost:61613

[global]
session.ping_interval = 300

# new logging configuration using the python stdlib logging.fileConfig
[loggers]
keys = root,orbited,orbited_TCPConnectionResource

[handlers]
keys = console,errors,connections

[formatters]
keys = generic

[logger_root]
level = INFO
handlers = console

[logger_orbited]
level = INFO
handlers = errors
qualname = orbited

[logger_orbited_TCPConnectionResource]
level = DEBUG
handlers = connections
qualname = orbited.cometsession.TCPConnectionResource

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = INFO
formatter = generic

[handler_errors]
class = FileHandler
args = ('error.log', 'w')
level = INFO
formatter = generic

[handler_connections]
class = FileHandler
level = DEBUG
formatter = generic
args = ('connections.log', 'w')

[formatter_generic]
format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s

网址:

from django.conf.urls.defaults import patterns, include, url

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

from django.conf.urls.defaults import *
from stompapp.views import *

urlpatterns = patterns('',
    (r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
            {'document_root': 'C:/Users/Hunter/DjangoBackup/comet/static'}),
    (r'^comet/', index),
    (r'^addMessage/', addMessage),
    (r'^site_media/(.*)$', 'django.views.static.serve', {'document_root': 'PATH_TO_YOUR_STATIC_FOLDER'}),
)

我希望我的问题出在那里?谢谢你的帮助:D

1 个答案:

答案 0 :(得分:0)

  

另外,当我加载页面时,它给了我一个错误。

究竟是什么错误?我想你说的是“没有找到处理程序的”处理程序“stomp.py”“消息吗?