parent
6d93862fb2
commit
1870c3a2fa
9 changed files with 130 additions and 31 deletions
Binary file not shown.
@ -0,0 +1,4 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
from __future__ import absolute_import |
||||||
|
from .celery import app as celery_app |
||||||
|
|
||||||
@ -0,0 +1,24 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
|
||||||
|
from __future__ import absolute_import |
||||||
|
|
||||||
|
import os |
||||||
|
|
||||||
|
from celery import Celery |
||||||
|
|
||||||
|
from django.conf import settings |
||||||
|
|
||||||
|
# set the default Django settings module for the 'celery' program. |
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings') |
||||||
|
|
||||||
|
app = Celery('proj') |
||||||
|
|
||||||
|
# Using a string here means the worker will not have to |
||||||
|
# pickle the object when using Windows. |
||||||
|
app.config_from_object('django.conf:settings') |
||||||
|
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) |
||||||
|
|
||||||
|
|
||||||
|
#@app.task(bind=True) |
||||||
|
#def debug_task(self): |
||||||
|
# print('Request: {0!r}'.format(self.request)) |
||||||
@ -0,0 +1,24 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
from __future__ import absolute_import |
||||||
|
from datetime import datetime |
||||||
|
|
||||||
|
from celery import shared_task |
||||||
|
from .models import License, UserProfile |
||||||
|
|
||||||
|
|
||||||
|
@shared_task |
||||||
|
def check_license(): |
||||||
|
profiles = UserProfile.objects.all() |
||||||
|
now = datetime.now() |
||||||
|
|
||||||
|
for profile in profiles: |
||||||
|
licenses = License.objects.filter(user=profile.user, date_from__lte=now, date_to__gte=now, status__in=[-1, 1, 2]) |
||||||
|
if licenses: |
||||||
|
profile.active = True |
||||||
|
else: |
||||||
|
profile.active = False |
||||||
|
profile.save() |
||||||
|
licenses.filter(status=1).update(status=2) |
||||||
|
|
||||||
|
return None |
||||||
|
|
||||||
@ -1,24 +1,35 @@ |
|||||||
Django==1.5.8 |
Django==1.5.8 |
||||||
|
Pillow==2.2.1 |
||||||
South==0.8.2 |
South==0.8.2 |
||||||
pillow==2.2.1 |
amqp==1.4.5 |
||||||
simplejson==3.3.1 |
anyjson==0.3.3 |
||||||
six==1.4.1 |
argparse==1.2.1 |
||||||
xlrd==0.9.2 |
billiard==3.3.0.18 |
||||||
xlwt==0.7.5 |
celery==3.1.12 |
||||||
|
django-autocomplete-light==1.4.9 |
||||||
|
django-classy-tags==0.5.1 |
||||||
|
django-cms==3.0.2 |
||||||
|
django-debug-toolbar==1.2.1 |
||||||
|
django-filter==0.7 |
||||||
|
django-mptt==0.6.0 |
||||||
|
django-sekizai==0.7 |
||||||
|
djangocms-admin-style==0.2.2 |
||||||
|
flup==1.0.2 |
||||||
html5lib==0.95 |
html5lib==0.95 |
||||||
|
ipython==2.1.0 |
||||||
|
kombu==3.0.20 |
||||||
pisa==3.0.33 |
pisa==3.0.33 |
||||||
|
psycopg2 |
||||||
pyPdf==1.13 |
pyPdf==1.13 |
||||||
reportlab==2.7 |
python-dateutil==2.2 |
||||||
django-filter==0.7 |
|
||||||
pytils==0.2.3 |
pytils==0.2.3 |
||||||
psycopg2 |
pytz==2014.4 |
||||||
|
reportlab==2.7 |
||||||
|
simplejson==3.3.1 |
||||||
|
six==1.4.1 |
||||||
|
sqlparse==0.1.11 |
||||||
|
wsgiref==0.1.2 |
||||||
|
xlrd==0.9.2 |
||||||
|
xlwt==0.7.5 |
||||||
flup |
flup |
||||||
django-autocomplete-light==1.4.9 |
|
||||||
django-cms==3.0.2 |
|
||||||
|
|
||||||
# dev |
|
||||||
#django-devserver |
|
||||||
#django-eml-email-backend |
|
||||||
django-debug-toolbar |
|
||||||
ipython |
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in new issue