TurnKey Linux Virtual Appliance Library

500 Internal Server Error - Django appliance

I just installed the Django appliance using all the default settings. Upon complete installation I try to access the sample Django site, but get "500 Internal Server Error".

I then try to upload a simple, static HTML file to the /var/www folder, but get the same error. 

While I am technically skilled, I have little/no experience with Linux and web-development in general - just getting started - so I need "babysteps assistance".

I browsed the forums, found others had similar problems, but found no solutions....

Kind regards,

Morten F. Thomsen
Norway

excerpt from apache log:

 

[Mon Feb 27 10:08:08 2012] [error] Exception KeyError: KeyError(-1220257136,) in <module 'threading' from '/usr/lib/python2.6/threading.pyc'> ignored
[Mon Feb 27 10:08:08 2012] [error] Exception KeyError: KeyError(-1220257136,) in <module 'threading' from '/usr/lib/python2.6/threading.pyc'> ignored
[Mon Feb 27 10:08:09 2012] [notice] caught SIGTERM, shutting down
[Mon Feb 27 10:08:09 2012] [error] Exception KeyError: KeyError(-1220257136,) in <module 'threading' from '/usr/lib/python2.6/threading.pyc'> ignored
[Mon Feb 27 10:08:24 2012] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Mon Feb 27 10:08:24 2012] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Mon Feb 27 10:08:24 2012] [notice] Apache/2.2.14 (Ubuntu) mod_ssl/2.2.14 OpenSSL/0.9.8k mod_wsgi/2.8 Python/2.6.5 configured -- resuming normal operations
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103] mod_wsgi (pid=2861): Exception occurred processing WSGI script '/var/www/project/wsgi_handler.py'.
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103] Traceback (most recent call last):
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103]   File "/usr/lib/pymodules/python2.6/django/core/handlers/wsgi.py", line 241, in __call__
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103]     response = self.get_response(request)
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103]   File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py", line 122, in get_response
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103]     return self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103]   File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py", line 166, in handle_uncaught_exception
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103]     return callback(request, **param_dict)
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103]   File "/usr/lib/pymodules/python2.6/django/views/defaults.py", line 23, in server_error
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103]     t = loader.get_template(template_name) # You need to create a 500.html template.
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103]   File "/usr/lib/pymodules/python2.6/django/template/loader.py", line 81, in get_template
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103]     source, origin = find_template_source(template_name)
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103]   File "/usr/lib/pymodules/python2.6/django/template/loader.py", line 74, in find_template_source
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103]     raise TemplateDoesNotExist, name
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103] TemplateDoesNotExist: 500.html
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103] mod_wsgi (pid=2861): Exception occurred processing WSGI script '/var/www/project/wsgi_handler.py'.
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103] Traceback (most recent call last):
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103]   File "/usr/lib/pymodules/python2.6/django/core/handlers/wsgi.py", line 241, in __call__
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103]     response = self.get_response(request)
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103]   File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py", line 122, in get_response
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103]     return self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103]   File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py", line 166, in handle_uncaught_exception
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103]     return callback(request, **param_dict)
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103]   File "/usr/lib/pymodules/python2.6/django/views/defaults.py", line 23, in server_error
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103]     t = loader.get_template(template_name) # You need to create a 500.html template.
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103]   File "/usr/lib/pymodules/python2.6/django/template/loader.py", line 81, in get_template
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103]     source, origin = find_template_source(template_name)
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103]   File "/usr/lib/pymodules/python2.6/django/template/loader.py", line 74, in find_template_source
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103]     raise TemplateDoesNotExist, name
[Mon Feb 27 10:08:46 2012] [error] [client 192.168.0.103] TemplateDoesNotExist: 500.html

500 error

I get the same error code with the lamp module.
I have found it to be the .htaccess file.

I believe you will have one in your WWW directory. If so, cripple the extension and test.
This is as much as I can help you at the moment, but if this is the case and I find a solution, I will write again.

Regards


500 error ps

if it is the htaccess file, try enabling the mod-rewrite.

apache server -> global configuration -> Configure Apache Modules -> enable rewrite

It doesn't enable it by default and this could sort out the issue for you


@Rohan - thanks for your

@Rohan - thanks for your input, but I don't seem to have any .htaccess files in the /var/www folder.

I tried enabling rewrite but no change.

-morten

Jeremy's picture

Shouldn't have any errors OOTB

So I am assuming that there is something wrng with your content. To troubleshoot what of your content/config is causing the issue, how about you turn on debugging?

@Jeremy - actually - I'm

@Jeremy - actually - I'm pretty sure there is nothing wrong with the content.  I downloaded the OVF file, launched it in VirtualBox and tried to access the demo-app that comes with the appliance. And I instantly get this error.

I tried to upload a static HTML file to test if that works, but I get the same error. Since I never reach any Django stuff, I don't see how turning on debug can help - not when a static html file gives the same error.

I downloaded the LAMP appliance, and that one works just fine...

I'm open to try anything if you have any ideas...

-morten

Jeremy's picture

Ok sorry, my apologies

That was just my assumption because that is not as it should be. I haven't actually tested the Django appliance myself so a TKL bug can't be 100% ruled out, but I'd be very surprised as you are the first to post about it AFAIK (and it was released some time ago).

Perhaps your download of the Django appliance was/is corrupted?

To me, the only other possibility is the unlikely event of an update breaking it. Considering your explanation of your usage (ie download, launch and test) if it were, it would've had to have been a buggy security update (assuming you allowed security updates on first boot). Whilst that isn't out of the realms of possibility, I would think it unlikely (it has only happened once in the 3 years I've been using TKL and it didn't break the general server functionality).

I tried re-downloading the

I tried re-downloading the OVF and re-installing it on my MacBook Pro - increased the memory to 1024 Mb memory (instead of using the default 256 Mb) - also allowed the update process to be performed. I got the same result.

Proceeded to install the OVF on my Windows 7 computer - skipped the update process - but got the same result here too.

I try to access http://x.x.x.x/project (where x.x.x.x is the IP adress to the appliance) - and I get the 500 Internal Server Error every time.

I have no idea what I am doing wrong - or what I am NOT doing - I sort of thought it is supposed to work out-of-the-box without any adjustments - but I am open for any suggestions you might have....

 

-morten

Jeremy's picture

Ok, just had a look

And from what I can gather, the example app is what you get when you browse to http://<appliance-ip>

It refers to the exaple app being found at /var/www/project (on the appliance page) but if you have a look at the apache django site config (/etc/apache2/sites-available/django) you can see that the document root for the site is /var/www/project so when you load http://<appliance-ip> it is loading the contents of /var/www/project

Sorry that you had to download a new OVF for no reason...

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)