Skip to content

Commit dcfa829

Browse files
authored
Merge pull request #30 from dabapps/django-and-python-support
Update Django and python support
2 parents 7cc9266 + 67d296a commit dcfa829

File tree

8 files changed

+35
-36
lines changed

8 files changed

+35
-36
lines changed

.travis.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@ language: python
22
sudo: false
33
services:
44
- mysql
5+
- postgresql
56
python:
6-
- '3.4'
7+
- '3.5'
78
- '3.6'
89
- '3.7'
10+
- '3.8'
911
env:
10-
- DJANGO_VERSION=1.8
11-
- DJANGO_VERSION=1.9
12-
- DJANGO_VERSION=1.10
13-
- DJANGO_VERSION=1.11
12+
- DJANGO_VERSION=1.11 DATABASE_URL=postgres://[email protected]/dbq
13+
- DJANGO_VERSION=2.2 DATABASE_URL=postgres://[email protected]/dbq
14+
- DJANGO_VERSION=1.11 DATABASE_URL=mysql://[email protected]/dbq
15+
- DJANGO_VERSION=2.2 DATABASE_URL=mysql://[email protected]/dbq
1416
install:
1517
- pip install -r test-requirements.txt
1618
- pip install -U django==$DJANGO_VERSION

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ Simple databased-backed job queue. Jobs are defined in your settings, and are pr
77

88
Asynchronous tasks are run via a *job queue*. This system is designed to support multi-step job workflows.
99

10-
Tested against Django 1.8, 1.9, 1.10, 1.11
10+
Supported and tested against:
11+
- Django 1.11 and 2.2
12+
- Python 3.7 and 3.8
13+
14+
This package may still work with older versions of Django and Python but they aren't explicitly supported.
1115

1216
## Getting Started
1317

django_dbq/fields.py

Lines changed: 0 additions & 7 deletions
This file was deleted.

django_dbq/migrations/0001_initial.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55
import jsonfield.fields
66
import uuid
77

8-
try:
9-
from django.db.models import UUIDField
10-
except ImportError:
11-
from django_dbq.fields import UUIDField
8+
from django.db.models import UUIDField
129

1310

1411
class Migration(migrations.Migration):

django_dbq/models.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,11 @@
22
from django.utils.module_loading import import_string
33
from django_dbq.tasks import get_next_task_name, get_failure_hook_name, get_creation_hook_name
44
from jsonfield import JSONField
5-
from model_utils import Choices
5+
from django.db.models import UUIDField
66
import datetime
77
import logging
88
import uuid
99

10-
try:
11-
from django.db.models import UUIDField
12-
except ImportError:
13-
from django_dbq.fields import UUIDField
14-
1510

1611
logger = logging.getLogger(__name__)
1712

@@ -61,13 +56,26 @@ def to_process(self, queue_name):
6156

6257
class Job(models.Model):
6358

64-
STATES = Choices("NEW", "READY", "PROCESSING", "FAILED", "COMPLETE")
59+
class STATES:
60+
NEW = 'NEW'
61+
READY = 'READY'
62+
PROCESSING = 'PROCESSING'
63+
FAILED = 'FAILED'
64+
COMPLETE = 'COMPLETE'
65+
66+
STATE_CHOICES = [
67+
(STATES.NEW, "NEW"),
68+
(STATES.READY, "READY"),
69+
(STATES.PROCESSING, "PROCESSING"),
70+
(STATES.FAILED, "FAILED"),
71+
(STATES.COMPLETE, "COMPLETE"),
72+
]
6573

6674
id = UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
6775
created = models.DateTimeField(auto_now_add=True, db_index=True)
6876
modified = models.DateTimeField(auto_now=True)
6977
name = models.CharField(max_length=100)
70-
state = models.CharField(max_length=20, choices=STATES, default=STATES.NEW, db_index=True)
78+
state = models.CharField(max_length=20, choices=STATE_CHOICES, default=STATES.NEW, db_index=True)
7179
next_task = models.CharField(max_length=100, blank=True)
7280
workspace = JSONField(null=True)
7381
queue_name = models.CharField(max_length=20, default='default', db_index=True)

setup.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616
author_email = '[email protected]'
1717
license = 'BSD'
1818
install_requires = [
19-
"django-model-utils==2.3.1",
20-
"django-uuidfield==0.5.0",
21-
"jsonfield==1.0.3",
19+
"jsonfield==2.0.2",
2220
"Django>=1.7",
2321
"simplesignals==0.3.0",
2422
]

test-requirements.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
-r requirements.txt
2-
pymysql==0.7.11
2+
mysqlclient==1.4.6
33
freezegun==0.3.12
44
mock==3.0.5
5+
dj-database-url==0.5.0
6+
psycopg2==2.8.4

testsettings.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
import os
2-
import pymysql
3-
pymysql.install_as_MySQLdb()
2+
import dj_database_url
43

54
DATABASES = {
6-
'default': {
7-
'ENGINE': 'django.db.backends.mysql',
8-
'NAME': 'django_db_queue',
9-
'PORT': os.getenv('DATABASE_PORT', 3306),
10-
},
5+
'default': dj_database_url.parse(os.environ['DATABASE_URL']),
116
}
127

138
INSTALLED_APPS = (

0 commit comments

Comments
 (0)