Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Wed May 20, 2009 2:15 pm 
Offline
Senior Newbie

Joined: Wed May 20, 2009 2:06 pm
Posts: 7
I am running
Ubuntu - 9.04
Python 2.6.2
Django - 1.1.0
MySQL - 5.0
MySQLdb 1.2.3c
Apache 2.2.11 (Ubuntu)
mod_wsgi 2.5


Problem is that when I activate Apache and try using a Django app I get this error:

"
500 Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
"

The django app are making use of MySQL database.
Strange thing is that
- same Django app work fine if I run it via Django development server (not appache)
- Other Django apps also works fine via apache / mod_wsgi as long as I don't use msql (I've tested apps with no databse or sqlite3)


Using Mysql via Python also appear to be working fine.
So -- any ideas why the combination Apache / mod_wsgi > Django / mysql is not working but individual components are?



Some thoughts

MySQLdb
I did battle to get MySQLdb working.
>>> import MySQLdb
# get no error
>>> MySQLdb.version_info
I still think problem is with MySQLdb although it is working by it self and with Django dev server

Python 2.6
I could move down to 2.5 and give it a go -- hasn't done it yet

Can I run apache / mod_wsgi in "debug mode" and get more info on error?


Many Thanks


Top
   
 Post subject:
PostPosted: Wed May 20, 2009 2:25 pm 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
I generally use the cgitb module to collect tracebacks... this will spit out a more detailed error instead of a 500, and also (optionally) dump out a file. (Really handy if your users get the errors and you don't...)

Here's an example of it in use: http://hoopycat.com/cgi-bin/broken.cgi


Top
   
 Post subject:
PostPosted: Wed May 20, 2009 3:23 pm 
Offline
Senior Newbie

Joined: Wed May 20, 2009 2:06 pm
Posts: 7
hoopycat -- thanks for quick response -- looks like a great feature.

I inserted:
import cgitb; cgitb.enable()

in my django.wsgi file (python) and my setup.py file.
No luck -- still Error 500 only.

If I comment out the following line in my settings.py file

DATABASE_ENGINE = 'mysql'

all is OK -- page displays fine.

The moment I add the above line (in settings.py) I get server 500 error.

Will try a few more options / google for idea.

Thanks


Top
   
 Post subject:
PostPosted: Wed May 20, 2009 3:39 pm 
Offline
Senior Newbie

Joined: Wed May 20, 2009 2:06 pm
Posts: 7
hoopycat -- thanks for quick response -- looks like a great feature.

I inserted:
import cgitb; cgitb.enable()

in my django.wsgi file (python) and my setup.py file.
No luck -- still Error 500 only.

If I comment out the following line in my settings.py file

DATABASE_ENGINE = 'mysql'

all is OK -- page displays fine.

The moment I add the above line (in settings.py) I get server 500 error.

Will try a few more options / google for idea.

Thanks


Top
   
 Post subject:
PostPosted: Wed May 20, 2009 4:05 pm 
Offline
Senior Member
User avatar

Joined: Mon Dec 10, 2007 4:30 pm
Posts: 341
Website: http://markwalling.org
Anything in your server error logs?

You said it works in 'runserver' mode?


Top
   
 Post subject:
PostPosted: Thu May 21, 2009 6:13 am 
Offline
Senior Member

Joined: Fri Feb 18, 2005 4:09 pm
Posts: 594
bosveld wrote:
DATABASE_ENGINE = 'mysql'


According to;
http://docs.djangoproject.com/en/dev/intro/tutorial01/
in the section labeled "database setup", it states that you must supply more parameters than that one alone - for example login id and password, along with a database name, then run "python manage.py syncdb". I use the default sqlite3 database myself - just session data.

James


Top
   
 Post subject:
PostPosted: Thu May 21, 2009 10:09 am 
Offline
Senior Newbie

Joined: Wed May 20, 2009 2:06 pm
Posts: 7
zunzun: I do specify the rest -- just omitted in my post.
Code:
DATABASE_ENGINE = 'mysql'  
DATABASE_NAME = 'demo1' 
DATABASE_USER = 'myuser'           
DATABASE_PASSWORD = 'mypassword'   
DATABASE_HOST = '127.0.0.1'     # also tried blank & localhost
DATABASE_PORT = ''

But all OK if I run using "python manage.py runserver 80"
Which make me think problem is not in settings.py


mwalling: In my Apache Logs

Code:
[notice] caught SIGTERM, shutting down

Still trying to puzzle out what this means...


Top
   
 Post subject:
PostPosted: Sat May 23, 2009 7:03 pm 
Offline
Senior Newbie

Joined: Wed May 20, 2009 2:06 pm
Posts: 7
Got problem solved.

Above problem was with Ubuntu 9.04
I moved to Debian 5.0 and all is working now.

Not 100% sure what main problem was -- but Ubuntu 9.04 has Python 2.6 as standard and Debian got 2.5 (which I prefer).

I still think it was that.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group