Не удалось найти обработчики для логгера "stomp.py" - PullRequest
0 голосов
/ 28 мая 2011

Я пытаюсь запустить Orbited согласно инструкциям на http://mischneider.net/?p=125

Вот копия ошибки:

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

URLs:

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 голосов
/ 28 мая 2011

Кроме того, когда я загружаю страницу, она выдает ошибку.

В чем именно ошибка? Я полагаю, вы говорите что-то еще, кроме сообщения "stomp.py" для логгера не найдено ни одного обработчика?

...