I have read the document but I can't find anything related. Please tell me what should I do if I want to specify a memcached+db backend for my session implementation. Thanks in advance. -- 无念无想
I think it is specified in the documentation. check in the "become big" chapter. regards Written from my iPhone ! Le 11 juin 2010 à 04:36, Satoru Logic <satorulogic@gmail.com> a écrit : > I have read the document but I can't find anything related. > Please tell me what should I do if I want to specify a memcached+db > backend for my session implementation. > Thanks in advance. > > -- > 无念无想
>> Am I supposed to be modifiing the flask module? > For sessions you can easily subclass the Flask object. The following > methods should be overriden: Flask.open_session and Flask.save_session. > You might want to use the werkzeug.contrib.session baseclass for > sessions when using memcached or something similar. > Regards, > Armin When searching for examples on subclassing the Flask object to implement a custom session store, I found this gist that uses a mixin: https://gist.github.com/994937 Is subclassing or using mixins the recommended pattern for customizing Flask behavior? - James
Hi James,
I tried it, but some problem occured.It says "AttributeError: 'SQLAlchemy'
object has no attribute 'query' "
I initialized the extension as below:
db = SQLAlchemy(app)
admin_mod = Admin(app, sys.modules[__name__], db,
exclude_pks=True)
SQLAlchemy is from flaskext.sqlalchemy.
Thanks.
2011/6/18 James Thornton <james@jamesthornton.com>
> >> Am I supposed to be modifiing the flask module?
> > For sessions you can easily subclass the Flask object. The following
> > methods should be overriden: Flask.open_session and Flask.save_session.
> > You might want to use the werkzeug.contrib.session baseclass for
> > sessions when using memcached or something similar.
> > Regards,
> > Armin
>
> When searching for examples on subclassing the Flask object to
> implement a custom session store, I found this gist that uses a mixin:
>
> https://gist.github.com/994937
>
> Is subclassing or using mixins the recommended pattern for customizing
> Flask behavior?
>
> - James
>
Am I supposed to be modifiing the flask module? On Fri, Jun 11, 2010 at 2:35 PM, Stephane Wirtel <stephane@wirtel.be> wrote: > I think it is specified in the documentation. check in the "become > big" chapter. > > regards > > Written from my iPhone ! > > Le 11 juin 2010 à 04:36, Satoru Logic <satorulogic@gmail.com> a > écrit : > >> I have read the document but I can't find anything related. >> Please tell me what should I do if I want to specify a memcached+db >> backend for my session implementation. >> Thanks in advance. >> >> -- >> 无念无想 > -- 无念无想
Le 11/06/2010 10:17, Satoru Logic a écrit : > Am I supposed to be modifiing the flask module? > Try subclassing the Flask class first. If that is not enough, try monkey-patching, and as a last resort change the flask module. If subclassing does not work, the best thing to do of course is to refactor the module so that it does work, and contribute your changes. But that is more more work so it’s up to you.
Hi,
On 6/11/10 10:17 AM, Satoru Logic wrote:
> Am I supposed to be modifiing the flask module?
For sessions you can easily subclass the Flask object. The following
methods should be overriden: Flask.open_session and Flask.save_session.
You might want to use the werkzeug.contrib.session baseclass for
sessions when using memcached or something similar.
Regards,
Armin