Przeglądaj źródła

Added example tasks and settings to examples/django/demoproject

Ask Solem 15 lat temu
rodzic
commit
ad50ad3e66

+ 6 - 0
examples/django/demoproject/demoapp/tasks.py

@@ -0,0 +1,6 @@
+from celery.decorators import task
+
+
+@task
+def add(x, y):
+    return x + y

+ 9 - 3
examples/django/demoproject/settings.py

@@ -7,11 +7,17 @@ ADMINS = (
     # ('Your Name', 'your_email@domain.com'),
 )
 
+CELERY_RESULT_BACKEND = "database"
+BROKER_HOST = "localhost"
+BROKER_PORT = 5672
+BROKER_USER = "guest"
+BROKER_PASSWORD = "guest"
+BROKER_VHOST = "/"
+
 MANAGERS = ADMINS
 
-DATABASE_ENGINE = ''           # 'postgresql_psycopg2', 'postgresql', 'mysql',
-                               # 'sqlite3' or 'oracle'.
-DATABASE_NAME = ''             # Or path to database file if using sqlite3.
+DATABASE_ENGINE = 'sqlite3'
+DATABASE_NAME = 'testdb.sqlite'
 DATABASE_USER = ''             # Not used with sqlite3.
 DATABASE_PASSWORD = ''         # Not used with sqlite3.
 DATABASE_HOST = ''             # Set to empty string for localhost.