I am working on a Django project, and need to run cron tasks periodically to go through and delete all outdated files. I tried this same method with django_extensions and crontab, but I keep getting this same error. Within settings.py, I have:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'Data_Science_Web_App',
'django_celery_beat',
]
in my INSTALLED_APPS section. 'Data_Science_Web_App' is the name of my application. When I used pip3 install django_celery_beat, it worked fine. However, when I try to migrate changes, I get this message:
(djangoenv) Daeyongs-Air:Data_Science_Project daeyong$ python3 manage.py migrate
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-
packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-
packages/django/core/management/__init__.py", line 377, in execute
django.setup()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-
packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-
packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-
packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py",
line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'django_celery_beat'
When I check using pip freeze, it is evident that django_celery_beat is there:
(djangoenv) Daeyongs-Air:Data_Science_Project daeyong$ pip freeze
amqp==5.0.2
asgiref==3.2.10
billiard==3.6.3.0
celery==5.0.5
certifi==2020.6.20
cffi==1.14.2
click==7.1.2
click-didyoumean==0.0.3
click-plugins==1.1.1
click-repl==0.1.6
cycler==0.10.0
Django==3.1.4
django-braces==1.14.0
django-celery-beat==2.1.0
django-common-helpers==0.9.2
django-cron==0.5.1
django-crontab==0.7.1
django-debug-toolbar==2.2
django-timezone-field==4.1.1
... and the list goes on.
Can somebody please help me discover the issue behind this? Thank you!