Using Python Packages in Django

瀏覽次數:26 次
跳到第一則未讀訊息

djangorobert

未讀,
2018年3月11日 下午2:09:222018/3/11
收件者:Django users
Have a question may be silly but want to know when using a library like the Python rx library package 
how would I use it in django?

Would I have to create a model?
or could I use it in a View Thanks


I was thinking in a View but was unsure if i could with a Function view instead 

Thanks 
IF you have had experience with it i would appreciate your INfo thanks.

Jani Tiainen

未讀,
2018年3月11日 下午4:02:182018/3/11
收件者:django...@googlegroups.com
Hi.

Django is just Python so you can use any library as you see fit.

You don't need to create any special models for that unless you want to store something to database.

If that package creteates output you want to show in template just calling it from a view is sufficient.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/094bbd87-d1fd-4885-981d-8507f8cb3b2d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

djangorobert

未讀,
2018年3月11日 下午6:03:092018/3/11
收件者:Django users
Hi Jani thanks 
I was thinking something like this 

from rx import Observable, Observer


people = ['robert', 'anna', 'jake', 'harry', 'lacey']

class MyObserver(Observer):
     templates = 'peron/people.html'
     context = {}
    def on_next(self, x):
        print("Found: {}".format(x))

    def on_error(self, e):
        print("Sorry got an error for: {e}".format(e))

    def on_completed(self):
        print('All Done')

p = Observable.from_iterable(people)
subscribe = p.subscribe(MyObserver())
return render(request, templates, context)

On Sunday, March 11, 2018 at 3:02:18 PM UTC-5, Jani Tiainen wrote:
Hi.

Django is just Python so you can use any library as you see fit.

You don't need to create any special models for that unless you want to store something to database.

If that package creteates output you want to show in template just calling it from a view is sufficient.
11.3.2018 20.10 "djangorobert" <djangoc...@gmail.com> kirjoitti:
Have a question may be silly but want to know when using a library like the Python rx library package 
how would I use it in django?

Would I have to create a model?
or could I use it in a View Thanks


I was thinking in a View but was unsure if i could with a Function view instead 

Thanks 
IF you have had experience with it i would appreciate your INfo thanks.

--
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.
回覆所有人
回覆作者
轉寄
0 則新訊息