Celery Tasks not showing in Django Admin - django

I've followed the all the docs I could find as closely as I could, even setting up an example project using Celery's official django example (celery/examples/django) but tasks still aren't showing up in django-admin:
https://github.com/mikeumus/django-celery-example
I've left a comment on a corresponding django-celery github issue here:
https://github.com/celery/django-celery/issues/335
I've been 3 days trying to get tasks to show and to be able to use all the awesome code seen in django-celery's admin.py for things like scheduling tasks but I've had no luck. I'm running the the camera event deamon. Don't know what I'm missing. Someone in #celery IRC said django-celery is working for them so I must just be missing something. Really excited to get my isolated django-celery github project working so people can just clone it when using the module so that they don't miss anything in the checklist of little things required to get it working.
Django version 1.7.1
Celery 3.1.18
Here's my ./manage.py celery -A proj worker -l info --loglevel=DEBUG and event camera output in a gist:
https://gist.github.com/mikeumus/133631d3fa66ad53280c
Any advice is greatly appreciated. Anyone can access the ubuntu environment I'm working in via Cloud 9 here: https://ide.c9.io/mikeumus/celery-django-example
If you need write access, just ask for it here first.
Thanks,
Mike

I have the same problem.
As a workaround you can use flower that is a monitoring tool for celery.
http://flower.readthedocs.io/en/latest/
Using flower you can see more information which is no provided for the admin site of django

Related

How to set virtualenv to stay active on a host server

I created a website that uses vuejs as the frontend and django as the backend with another service running behind everything that im making api calls to.
So django is setup in a way to look at the dist folder of Vuejs and serve it if you run manage.py runserver. but the problem is that my service that I created is
is also in python and it needs to run in a virtualenv in order to work (It uses tensorflow 1.15.2 and this can only run in a contained environment)
I'm sitting here and wondering how I can deploy the django application and keep the virtualenv active and Im coming up with nothing, I've tried doing some research on this but everything I found was not relevant to my problem. I've deployed it and when I close the ssh connection the virtualenv stops.
If there is anyone that can enlighten my ways I would appreciate it.
i think you need to nginx: https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04
if you are search for keep states just in terminal i suggest tmux https://github.com/tmux/tmux/wiki
You can use uWSGI and nginx to deploy Django apps on server. Here's helpful articles:
https://www.digitalocean.com/community/tutorials/how-to-set-up-uwsgi-and-nginx-to-serve-python-apps-on-centos-7
https://www.digitalocean.com/community/tutorials/how-to-set-up-uwsgi-and-nginx-to-serve-python-apps-on-centos-7
Django official docs also has a page about it: https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/uwsgi/
There are articles from developers so you can refer them in case you get stuck anywhere:
https://www.freecodecamp.org/news/django-uwsgi-nginx-postgresql-setup-on-aws-ec2-ubuntu16-04-with-python-3-6-6c58698ae9d3/
https://medium.com/#biswashirok/deploying-django-python-3-6-to-digital-ocean-with-uwsgi-nginx-ubuntu-18-04-3f8c2731ade1

How to setup and run Celery on windows?

Hello and thank your for your time
i have a big Django project and i'm developing it in PyCharm on Windows. Right now i need to use smart queries, so i want to add Celery on it. The main problem, that celery dropped support for Windows since v4.0. So my questions is:
1) How can i use rabbit/celery on windows?
2) I have some old answer, that suggest to use old version, that has support for windows, but maybe it has some way with virtual box or other staff to lanch it on windows?
You can use Docker to run your Celery, there is an official image in Docker Hub: https://hub.docker.com/_/celery/
It will take some time to learn how to use Docker though. But it's definitely worth it.
You could use Vagrant, but in this case you will have to spend some time to configure your Celery environment, at least I didn't find existing Celery Vagrant Box you could use in your project.

How to make update in Django webservice made in python on windows

I have installed Python 27 successfully.
And with respect to project requirement i have also installed following packages.
Django==1.4.3
MySQL-python==1.2.4
PIL==1.1.7
South==0.7.6
argparse==1.2.1
distribute==0.6.28
django-appconf==0.6
django-imagekit==2.0.2
pytz==2012j
six==1.2.0
wsgiref==0.1.2
Now the problem is, i dont know how to make this run, or visible in python.
Can anybody please help me, to get out from this.
I have to change few webservices and also want to add some functionality.
This webservices are attached with wordpress website.
So, please help me to configure whole this project on local (Windows PC).
Thanks in advance
Go for the Touch Command of Django for this issue,
I think it will make helpful to you.
Thanks!
i have solve this, find below instruction for users who have same queries:
Restarting the Spawned Server
If you change any Python code on your site, you’ll need to tell FastCGI the code has changed. But there’s no need to restart Apache in this case. Rather, just reupload mysite.fcgi – or edit the file – so that the timestamp on the file changes. When Apache sees the file has been updated, it will restart your Django application for you.
If you have access to a command shell on a Unix system, you can accomplish this easily by using the touch command:
touch mysite.fcgi
For more information:
http://www.djangobook.com/en/2.0/chapter12.html
Thanks

Django Celery Task does not execute with .delay

I am able to execute my task no problem using
scrape_adhoc_reporting([store], [types], inventory)
This is a problem though, because this task can easily take an hour. So I try to make the task async. I tried both of following:
scrape_adhoc_reporting.apply_async(args=[[store], [types], inventory])
scrape_adhoc_reporting.delay([store], [types], inventory)
Both of these methods did not work. The view just redirects as it should, but the task never gets executed. There are no errors in the error log. Any insight as to what I am doing wrong?
Edit: After looking around a little bit more, I see people talking about registering a task. Is this something I need to do?
I ran in the same issue and I just solved it. MattH is right: this is due to non-running workers.
I'm using Django (1.5), Celery (3.0+) and Django-Celery on Windows. To get Celery Beat working, I followed this tutorial: http://mrtn.me/blog/2012/07/04/django-on-windows-run-celery-as-a-windows-service/ as on Windows, Beat can only be launched as a service.
However, as you, my tasks were launched but not executed. This came from a bug in the packaged version django-windows-tools (from pip).
I fixed the issue by downloading the latest version of django-windows-tools from GitHub (https://github.com/antoinemartin/django-windows-tools).
If you want it to be run remotely, you need a worker process running with that task loaded and a routing system configured to get the task request sent between the caller and the worker.
Have a look at the celery documentation for workers and tasks.
The code that you're running is just executing the task locally.
When using asynchronous celery task in Windows normally you get an error that is fixed by setting a parameter.
i.e:
With Django in the file celery.py you should:
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'main.settings')
os.environ.setdefault('FORKED_BY_MULTIPROCESSING', '1') <== Add this line for Windows compatibility.
This will fix the problem on Windows and does not create incompatibility problems on other systems.

Django1.4 with Celery: A. Sqlite3 database as broker possible? B. Celery versions necessary to install?

I'm running into all sorts of errors when following the official celery guide for django projects. Before going into more detail of the errors I encountered I would like to be clear on the following issues:
Do you only need to install django-celery or do you need to install celery as well?
This official guide does not mention you should. I have read guides installing both and other not mentioning installing plain celery at all.
I am using sqlite3 as my database in my development environment, can you use an sqlite3 database with celery as a broker? The last person in this thread seems to hint it's not possible.
I am using django1.4 and django-celery 3.0.11
Btw the latest of a series of errors I an into is DatabaseError: no such table: djkombu_queue
Running pip install django-celery will install celery as well.
I uninstalled south and dropped the table south_migrationhistory. Then reran syncdb and everything worked as in the documentation. I don't know exactly why this was causing an error though. So the answer to the second question is yes, Sqlite3 is able to work as a broker for celery.