File tree Expand file tree Collapse file tree 4 files changed +30
-4
lines changed Expand file tree Collapse file tree 4 files changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -229,6 +229,17 @@ pip command::
229229
230230 $ pip install https://github.com/celery/django-celery-beat/zipball/master#egg=django-celery-beat
231231
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+
232243
233244TZ Awareness:
234245-------------
Original file line number Diff line number Diff line change 44
55from django .db import migrations , models
66import django .db .models .deletion
7+ from django .conf import settings
78
89
910class Migration (migrations .Migration ):
@@ -71,8 +72,15 @@ class Migration(migrations.Migration):
7172 auto_created = True , primary_key = True ,
7273 serialize = False , verbose_name = 'ID' )),
7374 ('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+ )),
7684 ('task' , models .CharField (
7785 max_length = 200 , verbose_name = 'task name' )),
7886 ('args' , models .TextField (
Original file line number Diff line number Diff line change @@ -259,8 +259,14 @@ class PeriodicTask(models.Model):
259259 """Model representing a periodic task."""
260260
261261 name = models .CharField (
262- _ ('name' ), max_length = 200 , unique = True ,
263- help_text = _ ('Useful description' ),
262+ _ ('name' ),
263+ max_length = getattr (
264+ settings ,
265+ 'DJANGO_CELERY_BEAT_NAME_MAX_LENGTH' ,
266+ 200
267+ ),
268+ unique = True ,
269+ help_text = _ ('Useful description' )
264270 )
265271 task = models .CharField (_ ('task name' ), max_length = 200 )
266272 interval = models .ForeignKey (
Original file line number Diff line number Diff line change 122122# https://docs.djangoproject.com/en/1.9/howto/static-files/
123123
124124STATIC_URL = '/static/'
125+ DJANGO_CELERY_BEAT_NAME_MAX_LENGTH = 191
125126DJANGO_CELERY_BEAT_TZ_AWARE = True
You can’t perform that action at this time.
0 commit comments