4

I have a problem in OSQA. Anytime, I try to enter a user's page, "500 Error" occurs such as here: http://turkrusforum.com/users/2/mertnuhoglu/

I checked the error logs. But there was nothing there. I want to install django-debug-toolbar and debug the problem more.

I put DEBUG = True and INTERNAL_IPS into settings.py. But I still cannot see debug toolbar.

Here it says that under Apache, this problem might be related to Alias settings.

Here is VirtualHost definition in my httpd.conf file:

<VirtualHost *:26903>
  ServerName turkrusforum.com
  KeepAlive Off
  WSGIDaemonProcess turkrusforum.com processes=1 python-path=/home/mertnuhoglu/webapps/otrf:/home/mertnuhoglu/webapps/otrf/osqa:/home/mertnuhoglu/webapps/otrf/lib/python2.6 threads=1 inactivity-timeout=360 display-name=[wsgi-otrf]httpd
  WSGIProcessGroup turkrusforum.com
  WSGIScriptAlias / /home/mertnuhoglu/webapps/otrf/otrf.wsgi
</VirtualHost>

May anyone help me to find out how to configure Alias settings?

Mert Nuhoglu
  • 9,695
  • 16
  • 79
  • 117

2 Answers2

2

A few things to keep in mind:

  1. Django_Toolbar only displays when INTERNAL_IPs matches the IP address of the machine requesting the page.

  2. It looks at the HTTP_X_FORWARDED_FOR header, which the WSGI Apache module should set (but might not, or might set incorrectly).

  3. If it doesn't find that header, it looks at REMOTE_ADDR, which in a proxy setup, is always 127.0.0.1.

So you need to verify that your setup is in fact setting the HTTP_X_FORWARDED_FOR correctly.

Easy way is to make a view and just do this:

def check_forward(request, *args, **kwargs):
    return HttpResponse(request.META.get('HTTP_X_FORWARDED_FOR', None))

Map that a URL and see whether that header is being set correctly.

Jack Shedd
  • 3,501
  • 20
  • 27
  • I put that view. The result is "212.253.42.119" which is the ip address that I had put into `INTERNAL_IPS = ('212.253.42.119',)` – Mert Nuhoglu Feb 25 '13 at 12:05
1

when you right click on webpage and inspect you can find in chrome console that some css and html files has 404 as response.

/static/debug_toolbar/css/toolbar.css
/static/debug_toolbar/js/toolbar.js
/static/debug_toolbar/img/ajax-loader.gif

These are static assets required by django toolbar to display the panel. The specified resources are not found in the static folder of my project. With more debugging that I found that django-debug-toolbar added to installed app is serving the static content in development box. When django project is hosted on apache all static files by default aliased to static folder. As files relating to django_toolbar doesn't exists server returns a 404 not found error. This can be resolved by copying the debug_toolbar which is in Python27\Lib\site-packages\debug_toolbar\static into project static folder.

kishore
  • 1,658
  • 7
  • 24
  • 33