Files
2012-02-21 01:15:00 -05:00

1 line
3.2 KiB
JSON

[{"user_id": 12501, "stars": [], "topic_id": 42777, "date_created": 1311724989.955817, "message": "Relatively new to Django. I'm integrating an iOS client with a Django API. The big HTML debug page is great if you're using it a browser but it's a huge pain otherwise. Is there a better way to set up Django if you're using it in this manner?", "group_id": 81, "id": 1727390}, {"user_id": 141, "stars": [], "topic_id": 42777, "date_created": 1311745643.62797, "message": "the decorator i use is like this: https://github.com/markpasc/make-a-face/blob/master/makeaface/makeaface/views.py#L32", "group_id": 81, "id": 1729092}, {"user_id": 141, "stars": [{"date_created": 1311775178.9492619, "user_id": 1126}, {"date_created": 1311780589.303133, "user_id": 15292}], "topic_id": 42777, "date_created": 1311745059.4065189, "message": "@amrox For API views that return machine responses, I usually use a decorator that catches exceptions and turns them into plaintext or JSON error responses", "group_id": 81, "id": 1729052}, {"user_id": 23352, "stars": [], "topic_id": 42777, "date_created": 1311745143.306304, "message": "Turn debug mode off in settings and you'll get tracebacks by e-mail. This is what you'll have to do once in production anyway. Django-sentry lets you view tracebacks with a browser, too.", "group_id": 81, "id": 1729060}, {"user_id": 141, "stars": [], "topic_id": 42777, "date_created": 1311745279.6153021, "message": "yeah, for actually getting the error out, use sentry. it gives you a page like the admin that you can sign into that errors can be logged to.", "group_id": 81, "id": 1729070}, {"user_id": 141, "stars": [], "topic_id": 42777, "date_created": 1311745376.446665, "message": "the sentry page will have all the traceback info that's in the nice debug page, but with debug off the client will get your regular 500 page", "group_id": 81, "id": 1729079}, {"user_id": 141, "stars": [], "topic_id": 42777, "date_created": 1311745425.559576, "message": "i still use the decorator approach so even the 500s for API views are still delivered in XML or JSON or whatever", "group_id": 81, "id": 1729081}, {"user_id": 37657, "stars": [], "topic_id": 42777, "date_created": 1311773612.450983, "message": "as indicated in : http://stackoverflow.com/questions/164427/change-django-templates-based-on-user-agent the details of process_response are in: https://docs.djangoproject.com/en/1.3/topics/http/middleware/#process_response", "group_id": 81, "id": 1731079}, {"user_id": 1126, "stars": [], "topic_id": 42777, "date_created": 1311775229.5986021, "message": "as others have mentioned, your API should be flexible enough (using middleware) to return a cleanly-formatted JSON response with an error code / message", "group_id": 81, "id": 1731295}, {"user_id": 37657, "stars": [], "topic_id": 42777, "date_created": 1311773531.711165, "message": "You can also create a MobileMiddleware to check if the request is mobile (request.mobile) as indicated in:and alter the response with a process_response", "group_id": 81, "id": 1731066}, {"user_id": 1126, "stars": [], "topic_id": 42777, "date_created": 1311775242.148387, "message": "but use something like e-mail or Sentry to actually debug it yourself", "group_id": 81, "id": 1731298}]