Re: Surreptitious caching of JS in Django

2010-09-01 Thread buddhasystem
I really didn't configure any caching of JS myself, with the exception that it gets served statically. Disabling cache altogether is not an attractive option as my testing goes against expensive queries. Reinout van Rees wrote: > > On 08/30/2010 07:52 PM, buddhasystem wrote:

Surreptitious caching of JS in Django

2010-08-30 Thread buddhasystem
Hello, with the generous help of many of you, I easily set up JSON caching feature in my Django app, in a few views. The problem I'm now facing is that according to what I observe, Django also caches Javascript code in its memcached backend. While this is a welcome behavior in a deployed app, it

Re: Caching JSON in Django

2010-08-25 Thread buddhasystem
ort cache > > def someview(req): > > par = req.GET.get('somepar') > key = "someview:%s" % par > data = cache.get(key, None) > > if not data: > # get data from database > # ... > cache.set(key, da

Re: Caching JSON in Django

2010-08-25 Thread buddhasystem
Hello -- I think that might be the case... I do extract parameters from GET. Am I out of luck? Jirka Vejrazka wrote: > >> Is your AJAX query POST or GET query? Because as you may know, POST >> queries >> are not cached, GET queries are. > > > Also, GET requests are not cached in some cas

Re: Caching JSON in Django

2010-08-25 Thread buddhasystem
Thanks much! a) I'm using GET b) In current set of queries, JSON data size is quite moderate PS. I am considering tweaking the links I sent to the AJAX app such that when possible, it accesses cache file space on the server as a directory, statically, bypassing Django. That's fast. The set of U

Re: Caching JSON in Django

2010-08-25 Thread buddhasystem
Thanks for you reply. I'm away from my coding machine, so I'll just answer a part of your question -- When I use the cache decorator in a view, I expect that as long as cache is valid, the code in the view does not get executed. And that's what I see when rendering a template with some little con

Re: Caching JSON in Django

2010-08-25 Thread buddhasystem
gt; > On 08/24/2010 11:15 PM, buddhasystem wrote: >> >> I'm trying to use native caching in Django as per >> http://docs.djangoproject.com/en/dev/topics/cache/ >> >> I followed the setup procedure to the tee (it's not hard, of course). >> What I

Caching JSON in Django

2010-08-24 Thread buddhasystem
Hello, I'm trying to use native caching in Django as per http://docs.djangoproject.com/en/dev/topics/cache/ I followed the setup procedure to the tee (it's not hard, of course). What I observe is that my app caches only views that deliver HTML. Since my application is heavily AJAX, that's not wh

Re: What's the best practice for initializing the state of the server?

2010-08-19 Thread buddhasystem
nvolve messing with the server, it's > better to factor this out of Django. You can use something like Fabric > for automating deployment tasks instead: > > http://docs.fabfile.org/0.9.1/ > > On 19 ago, 21:55, buddhasystem wrote: >> I need to initialize a few data str

What's the best practice for initializing the state of the server?

2010-08-19 Thread buddhasystem
I need to initialize a few data structures and potentially do other set-up as needed, only when the Django server comes up. What's the optimal way of doing that? -- View this message in context: http://old.nabble.com/What%27s-the-best-practice-for-initializing-the-state-of-the-server--tp2948784

Re: Bind variables in Oracle backend - how to use them?

2010-08-19 Thread buddhasystem
cursor and use that directly." This sounds > like a way of being able to use the django connection but use the direct > cx_Oracle functionality. > > Random thought - have you tried sqlalchemy? Does that have hint > support? I've never used it. > > Tim. >

Re: Bind variables in Oracle backend - how to use them?

2010-08-18 Thread buddhasystem
Thanks, I'll look into that. In the meantime, I managed to just use the cursor from cx_Oracle (as in the example on Oracle site) and the code looks slightly more elegant. However, both "my" and yours solution suffer from the same defect imho -- that the ORM machinery of Django is unusable. We are

Re: Bind variables in Oracle backend - how to use them?

2010-08-18 Thread buddhasystem
binds that will go through? Thanks Maxim Ian Kelly-2 wrote: > > On Aug 17, 4:59 pm, buddhasystem wrote: >> I guess the problem is that I need to use raw queries to provide "hints" >> to >> Oracle. > > There has been some chatter recently on the develope

Re: Bind variables in Oracle backend - how to use them?

2010-08-18 Thread buddhasystem
with binds that will go through? Thanks Maxim Ian Kelly-2 wrote: > > On Aug 17, 4:59 pm, buddhasystem wrote: >> I guess the problem is that I need to use raw queries to provide "hints" >> to >> Oracle. > > There has been some chatter recently on the develope

Re: Bind variables in Oracle backend - how to use them?

2010-08-17 Thread buddhasystem
I guess the problem is that I need to use raw queries to provide "hints" to Oracle. The class RawQuerySet does not have the "extra" method, as it appears. Ian Kelly-2 wrote: > > On Aug 13, 11:04 am, buddhasystem wrote: >> Friends, >> >> I'm i

Re: Different Django instances running on the same server

2010-08-13 Thread buddhasystem
Hello there, sure it can also be done, but it's hardly worth the effort imho. Just let these sit on two different ports and inform the client. If you are still compelled to redirect requests based on origin while using one external port, it's doable from inside Django as well -- you look at the r

Re: javascript

2010-08-13 Thread buddhasystem
That's easy as other people explained, but not too flexible. I like putting hidden divs in my HTML and using jQuery to find this and parse out the data. This way, you can store complete structures id needed. elharoussi wrote: > > Hi > Is it possible to give a javascript function a django varia

Re: Different Django instances running on the same server

2010-08-13 Thread buddhasystem
I think it's even simpler than this. When configuring your Apache, you specify a few different virtual hosts listening on different ports. For each host, you give a different PYTHONPAH. And that's it. CLIFFORD ILKAY wrote: > > On 08/12/2010 12:18 PM, Rick Caudill wrote: >> Hi, >> >> Is it poss

Re: Programmatically connecting to a database

2010-08-13 Thread buddhasystem
Do you think that implementing the Router class can be helpful as well? It might save writing some code, not sure. Your answer is on this blog post: http://tidbids.posterous.com/saas-with-django-and-postgresql Good luck -- View this message in context: http://old.nabble.com/Programmatic

Bind variables in Oracle backend - how to use them?

2010-08-13 Thread buddhasystem
Friends, I'm in need of an implementation which calls for using bind variables (in Oracle sense, not generic) in my SQL in a Django application. Any experience with that, anyone? TIA -- View this message in context: http://old.nabble.com/Bind-variables-in-Oracle-backend---how-to-use-them--tp