Explorar o código

Working (but not very useful) Python project example

Ask Solem %!s(int64=15) %!d(string=hai) anos
pai
achega
3932a99c45

BIN=BIN
examples/pythonproject/demoapp/celery.db


+ 10 - 4
examples/pythonproject/demoapp/celeryconfig.py

@@ -1,6 +1,12 @@
+import os
+import sys
+sys.path.insert(0, os.getcwd())
+
 DATABASE_ENGINE = "sqlite3"
 DATABASE_NAME = "celery.db"
-BROKER_HOST="localhost"
-BROKER_USER="guest"
-BROKER_PASSWORD="guest"
-BROKER_VHOST="/"
+BROKER_HOST = "localhost"
+BROKER_USER = "guest"
+BROKER_PASSWORD = "guest"
+BROKER_VHOST = "/"
+CELERY_BACKEND = "amqp"
+CELERY_IMPORTS = ("tasks", )

+ 16 - 0
examples/pythonproject/demoapp/test.py

@@ -0,0 +1,16 @@
+from tasks import add
+
+
+print(">>> from tasks import add")
+print(">>> add(4, 4)")
+res = add(4, 4)
+print(repr(res))
+
+print(">>> add.delay(4, 4)")
+res = add.delay(4, 4)
+print(repr(res))
+
+print(">>> add.delay(4, 4).wait()")
+res = add.delay(4, 4).wait()
+print(repr(res))
+