Andrew.

If you don't mind, would you see my WSGI application setting?

I modified "application" file in *project/wsgi* directory.

from web2py import wsgihandler
application = wsgihandler.application

Variable "application" seems a main handler of web request.
(Initially it was a function which renders HTML code)


Now I am struggling with this error
<type 'exceptions.AttributeError'> 'thread._local' object has no attribute 
'request'


in *application/welcome/models/db.py*

39.
40.
41.
42.
43.
44.

45.
46.
47.
48.

## - old style crud actions
## (more options discussed in gluon/tools.py)
#########################################################################

from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
auth = Auth(db, hmac_key=Auth.get_or_create_key())

crud, service, plugins = Crud(db), Service(), PluginManager()

## create all tables needed by auth if not custom tables
auth.define_tables()



in*  gluon/tools.py *

   @staticmethod
    def get_or_create_key(filename=None):
        request = current.request

        if not filename:
            filename = os.path.join(request.folder,'private','auth.key')
        if os.path.exists(filename):
            key = open(filename,'r').read().strip()




Variablesglobal current<thread._local object>requestundefinedcurrent.request
undefined


Thank you very much.

JungHyun


2012년 5월 16일 수요일 오전 3시 15분 28초 UTC+9, Andrew 님의 말:
>
> JungHyun,
>
> I've deployed the default web2py app to Openshift with no issues but 
> haven't played with it much. I'd be happy to share my project dir so you 
> can see how I've structured my wsgi file and various libs like gluon so 
> that the app will run. 
>
> I'll try and create a mysql cartridge and put the model in that to see 
> what happens.
>
> Andrew
>
> On Tuesday, May 15, 2012 2:55:07 AM UTC-5, JungHyun Kim wrote:
>>
>> Hello. I'm now trying to use redhat openshift.
>>
>> I am struggling access database - mysql-5.1 - which is set via openshift 
>> cartridge.
>> I got admin user(admin), password and database name(we2py).
>> So I modified database setting in models/db.py 
>>
>> as
>>
>> db = DAL('mysql://admin:passw...@web2py-codingday.rhcloud.com/web2py')
>>
>> But web2py application can't connect to mysql.
>>
>> OperationalError: (2003, "Can't connect to MySQL server on '
>> web2py-codingday.rhcloud.com' (111)")
>>
>> I think I couldn't understand enough. I am a noob for both web2py and 
>> openshift.
>>
>> How can I make web2py connect to database right?
>>
>> Thank you.
>>
>>
>>

Reply via email to