File tree Expand file tree Collapse file tree 3 files changed +27
-5
lines changed Expand file tree Collapse file tree 3 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -16,9 +16,13 @@ Quick start
1616
1717 path('blog_api/', include('blog.urls')),
1818
19- 3. Run ``python manage.py migrate`` to create the blog models.
19+ 3. Setup a module named 'backend'
2020
21- 4. Start the development server and visit http://127.0.0.1:8000/admin/
22- to create a poll (you'll need the Admin app enabled).
21+ 4. Using celery.py.sample as a guide, setup celery do that tasks will work
2322
24- 5. Visit http://127.0.0.1:8000/blog_api/ to see something.
23+ 5. Run ``python manage.py migrate `` to create the blog models.
24+
25+ 6. Start the development server and visit http://127.0.0.1:8000/admin/
26+ to create a poll (you'll need the Admin app enabled).
27+
28+ 7. Visit http://127.0.0.1:8000/blog_api/ to see something.
Original file line number Diff line number Diff line change 1+ from __future__ import absolute_import
2+ import os
3+ from celery import Celery
4+ from django.conf import settings
5+
6+ # set the default Django settings module for the 'celery' program.
7+ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')
8+ app = Celery('backend')
9+
10+ # Using a string here means the worker will not have to
11+ # pickle the object when using Windows.
12+ app.config_from_object('django.conf:settings', namespace='CELERY')
13+ app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
14+
15+
16+ @app.task(name="debug", bind=True)
17+ def debug_task(self):
18+ print('Request: {0!r}'.format(self.request))
Original file line number Diff line number Diff line change 11[metadata]
22name = django-tcb-blog
3- version = 0.1
3+ version = 0.2
44description = A Django backend based on DRF for blogging
55url = https://www.thecodeblogs.com/
66author = Brent Jameson
You can’t perform that action at this time.
0 commit comments