Hello Francois, thank you very much for your reply. Not it's all clear.
What about using shelve? import shelve db = shelve.open("database", "c") db["one"] = 1 db["two"] = 2 db["three"] = 3 db.close() db = shelve.open("database", "r") for key in db.keys(): print repr(key), repr(db[key]) regards Il giorno giovedì 24 ottobre 2013 23:10:43 UTC+2, François Schiettecatte ha scritto: > > John > > There are a couple of ways you can handle this, either you store the files > in a database as a TEXT blob, or as a temporary file somewhere. > > And you can identify your users with request.user if they have to have an > account, or request.session.session_key if they don't, the session_key is > the cookie. For either to work the client has to accept cookies. > > The temporary file approach will required a database table to link the > file name to the user. > > I have used all of these and they all work well. > > If you need the text to be persistent across sessions I would store it in > a database, if it is around for an hour then just store it in a temporary > file. > > And make sure you have a process to delete old data. > > Finally you could also compress the text when you save it. > > Hopes this helps. > > François > > > On Oct 24, 2013, at 3:51 PM, John Carlo <johncar...@gmail.com<javascript:>> > wrote: > > > Hello everybody, > > > > I'm a newbie with Django, I love it but something it's not clear to me. > So I'm here to make a question. Thank you in advance. > > > > I have an application that has some istances of custom classes I wrote. > At every client request, every istance creates a big list of strings. Then, > a function combines the lists generated from the istances and send them to > the client. > > I store the istances in the session, and the combining function get the > istances through session. The problem is that the lists of strings comsume > a lot of memory... > > I know that sessions are stored in database, I can see them in the table > django_session, but they are kept also in RAM, and this is my problem. > > How can I reduce the RAM memory consumption? > > > > I thought 2 ways: > > 1) Find a way to move the lists from the RAM and put them in the db, I > hope there is something built-in in django session, but I did not find them > > 2) Instead building the lists of strings, I create a temp file in which > I will append every string. In the end the combining function reads the > temp files and combines them > > > > Could you please help me? I'm really I'm really stuck on this... > > > > thank you very much! > > > > -- > > You received this message because you are subscribed to the Google > Groups "Django users" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to django-users...@googlegroups.com <javascript:>. > > To post to this group, send email to > > django...@googlegroups.com<javascript:>. > > > Visit this group at http://groups.google.com/group/django-users. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/c7118798-84fe-4a32-bba0-53452871b6ae%40googlegroups.com. > > > > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cbb30ae1-d903-4028-b8fa-7388c55d24d6%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.