I want to send push notifications to my users hourly.
from push_notifications.models import APNSDevice
print('test schedule task')
device = APNSDevice.objects.all()
if device is None:
print('None Device')
print('number of models is '+str(len(device)))
device.send_message('test')
Above is what I try to execute hourly.
But when executed that script, what i got is an error message :
"Traceback (most recent call last): File "/home/User/Folder/Project/App/schedule.py", line 1, in from push_notifications.models import APNSDevice ImportError: No module named push_notifications.models
2016-03-19 05:49:05 -- Completed task, took 0.00 seconds, return code was 1."
What should I do to solve this one?
print(sys.path)) is below :
['/home/User/Folder/Project/App', '/usr/local/lib/python2.7/dist-packages/snappy-2.3.2-py2.7-linux-x86_64.egg', '/usr/local/lib/python2.7/dist-packages/cypari-1.2.2-py2.7-linux-x86_64.egg', '/usr/local/lib/python2.7/dist-packages/pypng-0.0.18-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/FXrays-1.3.1-py2.7-linux-x86_64.egg', '/usr/local/lib/python2.7/dist-packages/spherogram-1.4.1-py2.7-linux-x86_64.egg', '/usr/local/lib/python2.7/dist-packages/plink-1.8-py2.7.egg', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/local/lib/python2.7/dist-packages/Orange/orng', '/usr/local/lib/python2.7/dist-packages/PIL', '/usr/lib/python2.7/dist-packages', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode']
push_notifications
is installed? – Sean Francis N. Ballaismodels.py
inside/home/User/Folder/Project/App/push_notifications/
? If this is Django I'd expect it to be in/home/User/Folder/Project/push_notifications/
, in which case you'd need to add/home/User/Folder/Project/
to yoursys.path
. – Giles Thomas