I am learning celery by following this tutorial.
I created the tasks as he did and tried running the code. But I get the following error
NameError: name 'shared_task' is not defined
This is my code
import requests
from bs4 import BeautifulSoup
import json
from datetime import datetime
import lxml
@shared_task
def scrape():
try:
...
This code is working for him but I get the above mentioned error. Not sure what I am doing wrong. Please help me
Thanks in advance
You need to import the celery shared_task
decorator as
from celery import shared_task
@shared_task
def scrape():
...
# your code