File tree Expand file tree Collapse file tree 4 files changed +28
-3
lines changed Expand file tree Collapse file tree 4 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -269,6 +269,17 @@ pip command::
269
269
270
270
$ pip install https://github.com/celery/django-celery-beat/zipball/master#egg=django-celery-beat
271
271
272
+ Issues with mysql
273
+ -----------------
274
+ If you want to run ``django-celery-beat `` with MySQL, you might run into some issues.
275
+
276
+ One such issue is when you try to run ``python manage.py migrate django_celery_beat ``, you might get the following error::
277
+ django.db.utils.OperationalError: (1071, 'Specified key was too long; max key length is 767 bytes')
278
+ To get around this issue, you can set::
279
+ DJANGO_CELERY_BEAT_NAME_MAX_LENGTH=191
280
+ (or any other value if any other db other than MySQL is causing similar issues.)
281
+ max_length of **191 ** seems to work for MySQL.
282
+
272
283
273
284
TZ Awareness:
274
285
-------------
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 @@ -317,7 +317,12 @@ class PeriodicTask(models.Model):
317
317
"""Model representing a periodic task."""
318
318
319
319
name = models .CharField (
320
- max_length = 200 , unique = True ,
320
+ max_length = getattr (
321
+ settings ,
322
+ 'DJANGO_CELERY_BEAT_NAME_MAX_LENGTH' ,
323
+ 200
324
+ ),
325
+ unique = True ,
321
326
verbose_name = _ ('Name' ),
322
327
help_text = _ ('Short Description For This Task' ),
323
328
)
Original file line number Diff line number Diff line change 123
123
# https://docs.djangoproject.com/en/1.9/howto/static-files/
124
124
125
125
STATIC_URL = '/static/'
126
+ DJANGO_CELERY_BEAT_NAME_MAX_LENGTH = 191
126
127
DJANGO_CELERY_BEAT_TZ_AWARE = True
You can’t perform that action at this time.
0 commit comments