Android access django rest framework makes HTTP 500 -


i'm experienced developer android , developing android application has django server side on heroku cloud.

i'm pretty new django , django rest framework dont how use except guide on website.

what trying using volley/asynchttpclient/apache http contact django server.

with each of these libraries got http 500 error on django in console output.

what tried on each of them adding data body or parameters. on volley - overrided getparams , added them hash on asynchttpclient - made requestparams on httpclient(apache) - used list of namevaluepair , added them entity of urlencodedform http post request.

i tried on volley , asynchttpclient add data body of request , didn't worked also.

i thought of changing server side because of trouble django causing me , please if have answer please give :)

this server side(django):

class user(apiview):     queryset = appuser.objects.all()      def get(self,request,format=none):         users = appuser.objects.all()         serialized_users = userserializer(users, many=true)         return httpresponse(serialized_users.data)      def post(self,request):         user_serializer = userserializer(data=request.data)         if user_serializer.is_valid():             user_serializer.save()             return httpresponse(status.http_201_created)         return httpresponse(status=status.http_406_not_acceptable) 

**there's no point show urls/models/serializer because works on google chrome method.

android(apache http client):

    try {                     defaulthttpclient client = new defaulthttpclient();                     httppost post = new httppost(url);                     list<namevaluepair> paramslist = new arraylist<namevaluepair>();                     paramslist.add(new basicnamevaluepair("user",userjson));                      post.setentity(new urlencodedformentity(paramslist));                      httpresponse response = client.execute(post);                     httpentity entity = response.getentity();                 } catch (exception e) {                  } 

android (asynchttpclient):

    try {                         requestparams params = new requestparams();                         params.put("user",userjson);                         mclient.post(msg.gettext().tostring(),params,new asynchttpresponsehandler() {                             @override                             public void onsuccess(int statuscode, header[] headers, byte[] responsebody) {                                 if(statuscode == 201) toast.maketext(mainactivity.this,"success" , toast.length_short).show();                             }                              @override                             public void onfailure(int statuscode, header[] headers, byte[] responsebody, throwable error) {    }                     });                 } catch (exception e) {                  } 

i'm clueless next because think covered options contacting server...

thanks

if not wrong, message in console says http 500 server error without cause right?

to debug more, add following settings(base.py)

logging = {  'version': 1,  'disable_existing_loggers': false,  'handlers': {    'console': {      'level': 'error',      'class': 'logging.streamhandler',      'stream': sys.stderr    },   },  'loggers': {    'django.request': {      'handlers': ['console'],      'propogate': true,      'level': 'error',    }  } } 

this few lines in settings print cause of 500 error in console, might clue doing wrong.


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -