Django Post Error 500
Contents |
here for a quick overview of the site Help Center Detailed django post 500 internal server error answers to any questions you might have Meta Discuss the django 500 error log workings and policies of this site About Us Learn more about Stack Overflow the django 500 error page company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join
Django 500 Error Template
the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up jQuery $.post to Django returns “500 Internal Server Error” up vote 6 down vote favorite 1 I am working on the django return 500 error jQuery tutorial (Link) but have been stuck at the section, "RATE ME: USING AJAX" jQuery: $(document).ready(function() { // generate markup $("#rating").append("Please rate: "); for ( var i = 1; i <= 5; i++ ) $("#rating").append("" + i + " "); // add markup to container and apply click handlers to anchors $("#rating a").click(function(e){ // stop normal link click e.preventDefault(); // send request $.post("/vote", {rating: $(this).html()}, function(xml) { // format and output result $("#rating div").html( "Thanks for rating, current average: " + $("average", xml).text() + ", number of votes: " + $("count", xml).text() ); }); }); }); urls.py: urlpatterns = patterns('', (r'^rating/$', 'ajax_rating.views.rating'), (r'^vote/$', 'ajax_rating.views.vote'), ) views.py: @csrf_exempt def vote(request): if request.is_ajax(): rating = request['rating'] f = open('ratings.dat', 'w') votes = json.load(f) votes.append(rating) f.close() dict = {} total_rating = sum(votes) dict['count'] = len(votes) dict['avg'] = total_rating / dict['count'] return HttpResponse(serializers.serialize('xml', dict), 'application/xml') else: return HttpResponse(statu
here for a quick overview of the site Help Center Detailed answers drupal 500 error to any questions you might have Meta Discuss the workings
Ruby On Rails 500 Error
and policies of this site About Us Learn more about Stack Overflow the company Business
Joomla 500 Error
Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the http://stackoverflow.com/questions/5941528/jquery-post-to-django-returns-500-internal-server-error Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up HTTP 500 error on POST up vote 0 down vote favorite I am following instructions from here How can I login to django http://stackoverflow.com/questions/17604214/http-500-error-on-post using tastypie to create a UserResource that can be used to login to my django user. However, I am running into HTTP 500 error when I run the code. I tried to debug it myself, but could not figure it out. I am not sure how I can troubleshoot the 500 error. Any thought you can give is appreciated. Thanks!! My code is as below: #####api.py from registration.views import register from tastypie.resources import ModelResource from tastypie.constants import ALL from django.contrib.auth.models import User from django.contrib.auth import authenticate, login, logout from tastypie.http import HttpUnauthorized, HttpForbidden from django.conf.urls.defaults import url from tastypie.utils import trailing_slash class UserResource(ModelResource): class Meta: queryset = User.objects.all() fields = ['first_name', 'last_name', 'email'] allowed_methods = ['get', 'post'] resource_name = 'user' def prepend_urls(self): return [ url(r"^(?P
»djangocommentsWant to join? Log in or sign up in seconds.|Englishlimit my search to /r/djangouse the following search https://www.reddit.com/r/django/comments/366rkw/javascript_ajax_is_raising_500_error/ parameters to narrow your results:subreddit:subredditfind submissions in "subreddit"author:usernamefind submissions by "username"site:example.comfind submissions from "example.com"url:textsearch for "text" in urlselftext:textsearch 500 error for "text" in self post contentsself:yes (or self:no)include (or exclude) self postsnsfw:yes (or nsfw:no)include (or exclude) results marked as django 500 error NSFWe.g. subreddit:aww site:imgur.com dogsee the search faq for details.advanced search: by author, subreddit...this post was submitted on 16 May 20155 points (78% upvoted)shortlink: remember mereset passwordloginSubmit a new linkSubmit a new text postdjangosubscribeunsubscribe17,235 readers~11 users here nowNews and links for Django developers. New to Django? Check out the /r/djangolearning subreddit. Django's Code of Conduct applies here, so be go