Re: django twisted model

2009-06-28 Thread Alex Clemesha

Hi,

On May 16, 8:55 pm, Timboy  wrote:
> I am looking to make a webmail client proof of concept in django. I
> ran across twisted mail and this 
> post:http://clemesha.org/blog/2009/apr/23/Django-on-Twisted-using-latest-t...
> showing how to use django on twisted.
>
> Can anyone point me in the right direction for actually getting data
> out of a twisted app into a django mail model?

There is a question in the comments section of that post,
and it looks as though it is almost identical to the question that
you are asking here.  I'd say you posted that question :-)

I attempted to answer the posted question, so I'll just repeat the
question
and answer here, and if you want me to go into more detail, please
ask and I'd be happy to!


Posted question
=
I am interested in knowing how to plug twisted data into a django
model. If I wanted to create an asynchronous django chat app on
twisted or a django email client using twisted.mail.
if I have a model how can I get my twisted mail data into it?


Posted Answer
=
As long as you have your environment correctly set up, you can just
import your Django models into any of your twisted modules! If your
queries are long-running, then you'll have to run them in a thread
using Twisted's deferToThread, so they don't block the reactor. If
you're just using a local sqlite db, and all your queries run pretty
quick, then just import the models and use them like normal.

--


If you want to see a larger, more complete example of doing this in
a real project, see http://codenode.org - specifically if you take
a look at the source code here:
http://github.com/codenode/codenode/tree/master
and poke around in the directory "codenode/frontend/async" you
will find the files "dbmanager.py" and "webresources.py".
The "dbmanager.py" file is all Django models and the "webresource.py"
file is using those models from twisted.web calls.

One important bit is to make sure that you do a:

os.environ['DJANGO_SETTINGS_MODULE'] = 'my.settings'

so that you can correctly important you django models
from any of your code that uses twisted.


Hope this helps,
-Alex


>
> TIA


--
Alex Clemesha
clemesha.org

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django twisted model

2009-05-21 Thread Timboy

Anyone familiar with using twisted and hooking it to a model?

On May 16, 8:55 pm, Timboy  wrote:
> I am looking to make a webmail client proof of concept in django. I
> ran across twisted mail and this 
> post:http://clemesha.org/blog/2009/apr/23/Django-on-Twisted-using-latest-t...
> showing how to use django on twisted.
>
> Can anyone point me in the right direction for actually getting data
> out of a twisted app into a django mail model?
>
> TIA
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



django twisted model

2009-05-16 Thread Timboy

I am looking to make a webmail client proof of concept in django. I
ran across twisted mail and this post:
http://clemesha.org/blog/2009/apr/23/Django-on-Twisted-using-latest-twisted-web-wsgi/
showing how to use django on twisted.

Can anyone point me in the right direction for actually getting data
out of a twisted app into a django mail model?

TIA
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---