This is very odd. Can any mod_wsgi expert explain this?
On Jul 25, 3:36 am, oktay <
onur.ok...@gmail.com> wrote:
> I solved the problem.
> It is strange but in sql.py before
> "self._pool_connection(lambda :MySQLdb.Connection" I add import
> MySQLdb.
> I print some logs from sql.py and the first import in sql.py is not
> processed when running with apache.
> I am not sure why first import is not processed but I solved my
> problem with adding
>
> "import MySQLdb" before MySQLdb.Connection is processed.
>
> self._pool_connection(lambda : MySQLdb.Connection(
> db=db,
> user=user,
> passwd=passwd,
> host=host,
> port=int(port),
> charset=charset,
> ))
> self._cursor = self._connection.cursor()
> self._execute = lambda *a, **b: self._cursor.execute(*a,
> **b)
> self._execute('SET FOREIGN_KEY_CHECKS=1;')
> self._execute("SET sql_mode='NO_BACKSLASH_ESCAPES';")
>
> On 24 Temmuz, 22:58,oktay<
onur.ok...@gmail.com> wrote:
>
> > I will be very glad if you can...
> > Thank you.
>
> > On 24 Temmuz, 22:51, Kenneth <
kenneth.t.lundst...@gmail.com> wrote:
>
> > > I´m running web2py on CentOS 5.something. If needed I could send you
> > > my Apache configuration files and others.
>
> > > Kenneth
>
> > > On Jul 24, 8:47 pm,oktay<
onur.ok...@gmail.com> wrote:
>
> > > > Hello again,
>
> > > > I installed PostgreSQL and psycopg2.
> > > > both in the command line for python24 and python26 can import
> > > > psycopg2.
>
> > > > But when I run from apache
> > > > "global name 'psycopg2' is not defined"
> > > > error appears.
>
> > > > Same problem with mysql driver.
>
> > > > apache/python can not find the python db drivers.
> > > > Is it related to wsgi configuration?
>
> > > > Do you have any advice? Where should I check?
>
> > > > Thank you...
>
> > > > On 24 Temmuz, 19:38,oktay<
onur.ok...@gmail.com> wrote:
>
> > > > > Yes, correct.
> > > > > web2y.py (including "import MySQLdb") works both with python2.4 and
> > > > > python2.6.
> > > > > and not working with apache.
>
> > > > > Also I make my wsgi configuration as described inhttp://
web2py.com/book/default/section/11/2
>
> > > > > On 24 Temmuz, 19:32, mdipierro <
mdipie...@cs.depaul.edu> wrote:
>
> > > > > > So it works when you do
>
> > > > > > python2.6 web2y.py
>
> > > > > > but not when you use apache. is that correct?
>
> > > > > > On Jul 24, 10:58 am,oktay<
onur.ok...@gmail.com> wrote:
>
> > > > > > > Yes, it works with "import MySQLdb" at the top of web2py.py:
>
> > > > > > > web2py Enterprise Web Framework
> > > > > > > Created by Massimo Di Pierro, Copyright 2007-2010
> > > > > > > Version 1.81.5 (2010-07-22 23:56:21)
> > > > > > > Database drivers available: MySQL
> > > > > > > Starting hardcron...
> > > > > > > WARNING:root:GUI not available because Tk library is not installed
>
> > > > > > > On 24 Temmuz, 18:52, mdipierro <
mdipie...@cs.depaul.edu> wrote:
>
> > > > > > > > As a test, can you try add
>
> > > > > > > > import MySQLdb
>
> > > > > > > > at the top of web2py.py and run
>
> > > > > > > > python2.6 web2py.py
>
> > > > > > > > Massimo
>