These are chat archives for django/django

23rd
Dec 2017
Luke-VideoLibre
@LukeVideo
Dec 23 2017 09:26
Drf is a API generator. You send a request to a given URL and get a json object corresponding to what your URL serve.
So I send a request to wether.com/API/mytown and I get a json objects describing the weather.
With drf you serialise your models and create a API view that returns the typical request for the given page formated in json.
@ultra2mh
That can then be use by angular by using the variable in the request as so (more or less)
Luke-VideoLibre
@LukeVideo
Dec 23 2017 09:32
my_weather = request.object
Var temp = my_weather.temp
Var wind = my_weather.wind
An depending on what you want to send from Django to angular you build the corresponding serialisers corresponding to your model's.
White Rabbit
@Wahtdb_twitter
Dec 23 2017 12:33

I have an algorithm in my Django app deployed on Heroku which predicts data. My problem is that this function works many hours to generate predictions. I need to do it faster. Much faster. The faster the better. It seems to me that the best solution would be to predict each object separately and asynchronously. I mean running predict(name1), predict(name2), predict(name3) ... at the same time. Any ideas how can I solve my problem?

    @sched.scheduled_job('cron', day_of_week='mon-fri' , hour=19, minute=35)
    def scheduled_job():


        objects = Object.objects.all().values("name")

        for key in objects:

            try:
                predict(key["name"])
            except:
                print("Error in prediction")

Normally when I run only one function it returns prediction in something around 4 minutes. I ran three functions in the way shown below. All three was working separately and simultaneously and all three returned predictions at the same time. However I have to wait 12 minutes for these predictions. So I'm not sure if any way would allow me to calculate it in a similar way but in this case the result would be 4 minutes to get 3 predictions. Any ideas? Maybe someone had a similar problem?

    @sched.scheduled_job('cron', day_of_week='mon-fri' , hour=19, minute=35)
    def scheduled_job():
    #body of the function

    @sched.scheduled_job('cron', day_of_week='mon-fri' , hour=19, minute=35)
    def scheduled_job():
    #body of the function

    @sched.scheduled_job('cron', day_of_week='mon-fri' , hour=19, minute=35)
    def scheduled_job():
    #body of the function
Amritpal Singh
@amrit3701
Dec 23 2017 17:34
Hello everyone
I have two Django apps. The first Django app depends on Python2 and while second Django app depends on Python3. On production server, django app which depends on Python2 is running by Apache which uses libapache2-mod-wsgi package. At the same time, can Apache run Django app which depends on Python3 because it requires libapache2-mod-wsgi-py3 package?