Urls.py: ... (r'^registration/check/([\w|\W]+)/$', register_check), ... Views.py: @csrf_exempt def register_check(request, variable): if request.is_ajax()
When you're running a public site you should always turn off the DEBUG setting. That will make your server run much faster, and http 500 internal server error iis will also prevent malicious users from seeing details of your application http 500 internal server error iis 6 that can be revealed by the error pages. However, running with DEBUG set to False means
Fix Http 500 Internal Server Error
you'll never see errors generated by your site - everyone will just see your public error pages. You need to keep track of errors that occur in deployed http://stackoverflow.com/questions/12015270/django-error-500-internal-server-error-when-doing-ajax-call sites, so Django can be configured to create reports with details about those errors. Email reports¶ Server errors¶ When DEBUG is False, Django will email the users listed in the ADMINS setting whenever your code raises an unhandled exception and results in an internal server error (HTTP status code 500). This gives the administrators immediate https://docs.djangoproject.com/en/1.10/howto/error-reporting/ notification of any errors. The ADMINS will get a description of the error, a complete Python traceback, and details about the HTTP request that caused the error. Note In order to send email, Django requires a few settings telling it how to connect to your mail server. At the very least, you'll need to specify EMAIL_HOST and possibly EMAIL_HOST_USER and EMAIL_HOST_PASSWORD, though other settings may be also required depending on your mail server's configuration. Consult the Django settings documentation for a full list of email-related settings. By default, Django will send email from root@localhost. However, some mail providers reject all email from this address. To use a different sender address, modify the SERVER_EMAIL setting. To activate this behavior, put the email addresses of the recipients in the ADMINS setting. See also Server error emails are sent using the logging framework, so you can customize this behavior by customizing your logging configuration. 404 errors¶ Django can also be configured to email errors about broken links (404 "p
are addressed in this guide, some problems may require additional investigation to resolve. Here are some common strategies for resolving problems with Django applications. Reviewing Django Logs in Real Time¶ You can review https://docs.webfaction.com/software/django/troubleshooting.html the logs of a Django application as they are recorded using tail with http://grokbase.com/t/gg/django-users/12556w8fky/ajax-call-says-networkerror-500-internal-server-error-http-127-0-0-1-8000-ajax the log file. To review the logs in real time: Open an SSH session to your account. Switch to the user logs directory. Enter cd $HOME/logs/user and press Enter. Enter tail -f error_django_app.log, where django_app is the name of the Django application as it appears in the control panel 500 internal and press Enter. New additions to the error log will automatically appear on screen. You can now access the site and see any log entries as they appear. See also Accessing Logs Using the DEBUG Setting¶ Django has a built-in debug mode, provided by the DEBUG setting in your Django project's settings module. When DEBUG is enabled and an exception is 500 internal server raised, a detailed debugging output (including a stack trace) is rendered instead of attempting to render the 500 template. See also Django Documentation > Settings > DEBUG Warning Do not leave DEBUG set to True during normal operation. In addition to showing users unnecessary and potentially compromising configuration details in error pages, the DEBUG setting also causes Django to consume significantly more memory, which may exceed plan allotments. To enable the Django DEBUG setting: Open an SSH session. Open settings.py for the Django application. Typically, this file is found in $HOME/webapps/django_app/project/project. If it already exists, edit the line containing DEBUG = False to DEBUG = True. Otherwise, add a new line containing DEBUG = True to the file. Restart the Django application. Now, when an error occurs, a stack trace, settings information, and other valuable data is provided instead of rendering an error page. To force the appearance of the Django debugging page, add an assert False to a view and attempt to access it. Using the Django Debug Toolbar¶ The Django Debug Toolbar is a pluggable Django app that adds debugging informat
hi there,i have a small problem. i googled a lot, but couldnot find anything whichhelps me.i have $.ajax call and before that i have included the js file where i havethat csrf-protection code from djangodocs.here is my ajax call: http://dpaste.com/hold/743156/but once i click on the event, i get this error: "NetworkError: 500INTERNAL SERVER ERROR - http://127.0.0.1:8000/ajax/".my urls.py has: url(r'^ajax/', 'home.views.ajax'),and my ajax function is simply:def ajax(request):print 'test'i dont have any clues why this is happening. can someone please help me?many many thanks--You received this message because you are subscribed to the Google Groups "Django users" group.To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/1Y1E6RZOc7wJ.To post to this group, send email to django-users@googlegroups.com.To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.For more options, visit this group at http://groups.google.com/group/django-users?hl=en. reply Tweet Search Discussions Search All Groups django-users 2 responses Oldest Nested Alexandr Aibulatov Your view should return an HttpResponse Object. Your view prints 'test' and returns NoneType Object. Yours view should be like this: from django.http import HttpResponse def ajax(request): return HttpResponse('test', mimetype="text/plain") 2012/5/5 doniyor : -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to Alexandr Aibulatov at May 5, 2012 at 7:50 am ⇧ Your view should return an HttpResponse Object. Your view prints'test' and returns NoneType Object.Yours view should be like this:from django.http import HttpResponsedef ajax(request):return HttpResponse('test', mimetype="text/plain")2012/5/5 doniyor :hi there,i have a small problem. i googled a lot, but couldnot find anything whichhelps me.i have $.ajax call and before that i have included the js file where i havethat csrf-protection code from djangodocs.here is my ajax call:http://dpaste.com/hold/743156/but once i click on the event, i get this error:"NetworkError: 500 INTERNALSERVER ERROR - http://127.0.0.1:8000/ajax/".my urls.py has:url(r'^ajax/', 'home.views.ajax'),and my ajax function is simply:def ajax(request):print 'test'i dont have any clues why this is happening. can someone please help me?many many thanks--You received this message because you are subs