File tree Expand file tree Collapse file tree 4 files changed +31
-4
lines changed Expand file tree Collapse file tree 4 files changed +31
-4
lines changed Original file line number Diff line number Diff line change @@ -229,6 +229,17 @@ pip command::
229
229
230
230
$ pip install https://github.com/celery/django-celery-beat/zipball/master#egg=django-celery-beat
231
231
232
+ Issues with mysql
233
+ -----------------
234
+ If you want to run ``django-celery-beat `` with MySQL, you might run into some issues.
235
+
236
+ One such issue is when you try to run ``python manage.py migrate django_celery_beat ``, you might get the following error::
237
+ django.db.utils.OperationalError: (1071, 'Specified key was too long; max key length is 767 bytes')
238
+ To get around this issue, you can set::
239
+ DJANGO_CELERY_BEAT_NAME_MAX_LENGTH=191
240
+ (or any other value if any other db other than MySQL is causing similar issues.)
241
+ max_length of **191 ** seems to work for MySQL.
242
+
232
243
.. |build-status | image :: https://secure.travis-ci.org/celery/django-celery-beat.svg?branch=master
233
244
:alt: Build status
234
245
:target: https://travis-ci.org/celery/django-celery-beat
Original file line number Diff line number Diff line change 4
4
5
5
from django .db import migrations , models
6
6
import django .db .models .deletion
7
+ from django .conf import settings
7
8
8
9
9
10
class Migration (migrations .Migration ):
@@ -71,8 +72,15 @@ class Migration(migrations.Migration):
71
72
auto_created = True , primary_key = True ,
72
73
serialize = False , verbose_name = 'ID' )),
73
74
('name' , models .CharField (
74
- help_text = 'Useful description' , max_length = 200 ,
75
- unique = True , verbose_name = 'name' )),
75
+ help_text = 'Useful description' ,
76
+ max_length = getattr (
77
+ settings ,
78
+ 'DJANGO_CELERY_BEAT_NAME_MAX_LENGTH' ,
79
+ 200
80
+ ),
81
+ unique = True ,
82
+ verbose_name = 'name'
83
+ )),
76
84
('task' , models .CharField (
77
85
max_length = 200 , verbose_name = 'task name' )),
78
86
('args' , models .TextField (
Original file line number Diff line number Diff line change 6
6
import timezone_field
7
7
from celery import schedules
8
8
from celery .five import python_2_unicode_compatible
9
+ from django .conf import settings
9
10
from django .core .exceptions import MultipleObjectsReturned , ValidationError
10
11
from django .core .validators import MaxValueValidator
11
12
from django .db import models
@@ -248,8 +249,14 @@ class PeriodicTask(models.Model):
248
249
"""Model representing a periodic task."""
249
250
250
251
name = models .CharField (
251
- _ ('name' ), max_length = 200 , unique = True ,
252
- help_text = _ ('Useful description' ),
252
+ _ ('name' ),
253
+ max_length = getattr (
254
+ settings ,
255
+ 'DJANGO_CELERY_BEAT_NAME_MAX_LENGTH' ,
256
+ 200
257
+ ),
258
+ unique = True ,
259
+ help_text = _ ('Useful description' )
253
260
)
254
261
task = models .CharField (_ ('task name' ), max_length = 200 )
255
262
interval = models .ForeignKey (
Original file line number Diff line number Diff line change 122
122
# https://docs.djangoproject.com/en/1.9/howto/static-files/
123
123
124
124
STATIC_URL = '/static/'
125
+ DJANGO_CELERY_BEAT_NAME_MAX_LENGTH = 191
You can’t perform that action at this time.
0 commit comments