<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap:break-word"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div> <br> <div id="bloop_sign_1507189258557868032" class="bloop_sign"></div> <br><p class="airmail_on">On 4 October 2017 at 11:29:13, Karim (<a href="mailto:lemieliste@gmail.com">lemieliste@gmail.com</a>) wrote:</p> <div><blockquote type="cite" class="clean_bq" style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span><div><div></div><div><div dir="auto">Ciao lista, sto cercando di mantenere i risultati dei task avviati tramite celery su un'applicazione Django. I risultati vengono salvati su redis, ma quando faccio il deploy di una nuova app, tutto viene perso.</div></div></div></span></blockquote></div><p>Io in passato ho usato <a href="https://github.com/celery/django-celery">Django-celery</a> che offriva tutti i modelli Django e manteneva sincronizzati sul db tutti i dati dei task, dei task periodici e relativi risultati.</p><p>Adesso l’integrazione con Django é cambiata, ma dalla guida ufficiale di celery hai la possibilità di salvare i risultati in DB:</p><p class="first" style="line-height:1.4em;color:rgb(62,67,73);font-family:Optima,Segoe,'Segoe UI',Candara,Calibri,Arial,sans-serif;font-size:17px;font-variant-ligatures:normal;margin-top:0px!important">Configure Celery to use the <a class="reference external" href="https://pypi.python.org/pypi/django-celery-results/" style="color:rgb(52,134,19);text-decoration:none;border-bottom:1px dashed rgb(220,240,213)">django-celery-results</a> backend.</p><blockquote style="margin:0px 0px 0px 30px;padding:0px;color:rgb(62,67,73);font-family:Optima,Segoe,'Segoe UI',Candara,Calibri,Arial,sans-serif;font-size:17px;font-variant-ligatures:normal"><p style="line-height:1.4em">Assuming you are using Django’s <code class="file docutils literal">settings.py</code> to also configure Celery, add the following settings:</p><div class="highlight-python"><div class="highlight" style="background-position:initial initial;background-repeat:initial initial"><pre style="overflow-x:auto;overflow-y:hidden;font-family:Consolas,Menlo,'Deja Vu Sans Mono','Bitstream Vera Sans Mono',monospace;font-size:0.9em;background-color:rgb(240,255,235);padding:7px 10px;margin-top:15px;margin-bottom:15px;border:1px solid rgb(199,236,184);border-top-left-radius:2px;border-top-right-radius:2px;border-bottom-right-radius:2px;border-bottom-left-radius:2px;line-height:1.3em;background-position:initial initial;background-repeat:initial initial"><span class="n">CELERY_RESULT_BACKEND</span> <span class="o" style="color:rgb(51,51,51)">=</span> <span class="s1" style="background-color:rgb(255,240,240)">'django-db'</span>
</pre></div></div><p style="line-height:1.4em">For the cache backend you can use:</p><div class="highlight-python"><div class="highlight" style="background-position:initial initial;background-repeat:initial initial"><pre style="overflow-x:auto;overflow-y:hidden;font-family:Consolas,Menlo,'Deja Vu Sans Mono','Bitstream Vera Sans Mono',monospace;font-size:0.9em;background-color:rgb(240,255,235);padding:7px 10px;margin-top:15px;margin-bottom:15px;border:1px solid rgb(199,236,184);border-top-left-radius:2px;border-top-right-radius:2px;border-bottom-right-radius:2px;border-bottom-left-radius:2px;line-height:1.3em;background-position:initial initial;background-repeat:initial initial"><span class="n">CELERY_RESULT_BACKEND</span> <span class="o" style="color:rgb(51,51,51)">=</span> <span class="s1" style="background-color:rgb(255,240,240)">'django-cache'</span></pre></div></div></blockquote><p><br></p><div><div><blockquote type="cite" class="clean_bq" style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span><div><div><div dir="auto"><br class="Apple-interchange-newline"><br></div><div dir="auto">Non conosco redis, ma a quanto ne so la sua natura è quella di non mantenere i dati.</div><div dir="auto"><br></div><div dir="auto">Voi come fate? Ho a disposizione anche un db server Postgres quindi pensavo di usare quello per i risultati.</div><div dir="auto"><br></div><div dir="auto">Per monitorare celery uso flower.</div><div dir="auto"><br></div><div dir="auto">Avete qualche idea?</div></div></div></span></blockquote></div><p>Adesso non metto mano alle configurazioni, ma mi sono trovato molto bene (risolto qualche problema iniziale).</p><p>Prestissimo dovrò integrarlo in nuovo progetto e scoprire le ultime novità.</p><p><br></p><div><blockquote type="cite" class="clean_bq" style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span><div><div><div dir="ltr"><br class="Apple-interchange-newline">--<br></div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Karim N. Gorjux<br></div></div>_______________________________________________<br>Python mailing list<br><a href="mailto:Python@lists.python.it">Python@lists.python.it</a><br><a href="https://lists.python.it/mailman/listinfo/python">https://lists.python.it/mailman/listinfo/python</a><br></div></div></span></blockquote></div></div></body></html>