2011-05-28 97 views
0

我試圖讓運行軌道上http://mischneider.net/?p=125沒有處理程序可以發現記錄器「stomp.py」

這裏運行按指令是錯誤的副本:

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

回答

0

Also, when I load the page it gives me an error.

究竟是什麼錯誤?我猜你正在談論的東西比「沒有處理程序可以找到記錄器」stomp.py「」消息?

+0

錯誤彈出,只是說「錯誤」。我假設它與處理程序丟失有關。 – RHH 2011-05-28 08:07:39

相關問題