简体   繁体   中英

500 internel server error

I am trying to fetch data from facebook api. Here is the code for sending message to my django application

What I am doing is I combine the status into asd@@@@@qe@@@@@@ form and try to split the form in my django part.

However, I have POST http://chaop.webfactional.com/get-message/ 500 (INTERNAL SERVER ERROR) this problem

 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'),

)

BTW: Is there a way that I can add an array to the django and how does django deal with it?

Thank you very much

This is the error I get when I go there. Do you get the same?

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

If so check out importlib.py line 35.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM