1

I have an issue with my deployed application on an apache2 with mod_wsgi. The connection process to the database is exactly successful only once out of 2! I've named the database 'CKP' and for some reason have to change to 'ckp'.

So when I request a page of the application once out of two, I can read in the error log of apache:

mod_wsgi (pid=16098): Target WSGI script '/u1/msc/vg55/public_html/core_knowledge_web_platform/wsgi.py' cannot be loaded as Python module.
mod_wsgi (pid=16098): Exception occurred processing WSGI script '/u1/msc/vg55/public_html/core_knowledge_web_platform/wsgi.py'.
Traceback (most recent call last):
  File "/u1/msc/vg55/public_html/core_knowledge_web_platform/wsgi.py", line 20, in <module>
    command.validate()
  File "/usr/lib/python2.6/site-packages/django/core/management/base.py", line 249, in validate
    num_errors = get_validation_errors(s, app)
  File "/usr/lib/python2.6/site-packages/django/core/management/validation.py", line 102, in get_validation_errors
    connection.validation.validate_field(e, opts, f)
  File "/usr/lib/python2.6/site-packages/django/db/backends/mysql/validation.py", line 14, in validate_field
    db_version = self.connection.get_server_version()
  File "/usr/lib/python2.6/site-packages/django/db/backends/mysql/base.py", line 338, in get_server_version
    self.cursor()
  File "/usr/lib/python2.6/site-packages/django/db/backends/__init__.py", line 250, in cursor
    cursor = self.make_debug_cursor(self._cursor())
  File "/usr/lib/python2.6/site-packages/django/db/backends/mysql/base.py", line 322, in _cursor
    self.connection = Database.connect(**kwargs)
  File "/usr/lib64/python2.6/site-packages/MySQLdb/__init__.py", line 81, in Connect
    return Connection(*args, **kwargs)
  File "/usr/lib64/python2.6/site-packages/MySQLdb/connections.py", line 187, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (1044, "Access denied for user 'ckpuser'@'%' to database 'CKP'")

If it could help, I've integrated the improved WSGI script for use with Django given by Graham Dumpleton in his blog. Thanks for any suggestion.

renard
  • 1,368
  • 6
  • 20
  • 40
  • Your solution is wrong and bad as well. First off, 'mod_wsgi.process_group' is never in os.environ. It is 'environ' dictionary passed to the WSGI application, but it is always present whether or not using daemon mode. Even if you get that right, killing the process after every request is bad approach. You are better off touching WSGI script after any change, or implementing the code monitor (if development) as described towards end of that document you reference. – Graham Dumpleton Feb 24 '12 at 21:22

0 Answers0