500内部服务器错误

时间:2014-03-24 07:26:33

标签: python django facebook

我正在尝试从facebook api获取数据。 这是将消息发送到我的django应用程序的代码

我正在做的是将状态合并到asd @@@@@ qe @@@@@@ form并尝试 在我的django部分拆分表格。

但是,我有POST http://chaop.webfactional.com/get-message/ 500(INTERNAL SERVER ERROR)这个问题

 var getPosts = function (response)
{ 
    if(response.data != null)
  {
 for (var i=0; i<response.data.length; i++)
  {
    console.log(response.data[i].message)
    if(response.data[i].message != null)
    {
      message = message + response.data[i].message;
      message = message + '%%%%%'
      console.log(message)
    }
 }
  if(response.paging != null){
   nextPage = response.paging.next;
   console.log(nextPage);
   $.get(nextPage, getPosts, "json")
  }
  else $.post('/get-message/',{message: message,csrfmiddlewaretoken:'{{csrf_token}}'});
  }
}
 FB.api('/me/feed', function(response)
{
if (response.data.length >0){
for (var i=0; i<response.data.length; i++)
  {
    console.log(response.data[i].message)
    if(response.data[i].message != null)
    {
      message = message + response.data[i].message;
      message = message + '%%%%%'
      console.log(message)
    }

 }
console.log(message)
if(response.paging != null){
nextPage = response.paging.next;
console.log(nextPage);
$.get(nextPage, getPosts, "json")

}
else $.post('/get-message/',{message: message, csrfmiddlewaretoken:'{{csrf_token}}' });

}

my views.py

def get_message(request):                                                                                                                  
    return render(request, 'suv/index.html')

my urls.py

urlpatterns = patterns('',
    url(r'^$', 'suv.views.home'),
    url(r'^get-message', 'suv.views.get_message'),

顺便说一下:有没有办法可以在django中添加一个数组,django如何处理它?

非常感谢

1 个答案:

答案 0 :(得分:0)

这是我去那里时遇到的错误。你也一样吗?

ImportError at /get-message/
No module named home
Request Method: GET
Request URL:    http://chaop.webfactional.com/get-message/
Django Version: 1.5.1
Exception Type: ImportError
Exception Value:    
No module named home
Exception Location: /home/chaop/webapps/my_app2/lib/python2.7/django/utils/importlib.py in import_module, line 35
Python Executable:  /usr/local/bin/python
Python Version: 2.7.5
Python Path:    
['/home/chaop/webapps/my_app2',
'/home/chaop/webapps/my_app2/myproject',
'/home/chaop/webapps/my_app2/lib/python2.7',
'/home/chaop/lib/python2.7',
'/usr/local/lib/python27.zip',
'/usr/local/lib/python2.7',
'/usr/local/lib/python2.7/plat-linux2',
'/usr/local/lib/python2.7/lib-tk',
'/usr/local/lib/python2.7/lib-old',
'/usr/local/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/site-packages',
'/usr/local/lib/python2.7/site-packages/PIL']
 Server time:   Mon, 24 Mar 2014 02:45:39 -0500

如果是这样,请查看importlib.py第35行。