urda / django-letsencrypt

A simple Django app to handle Let's Encrypt ACME challenges
https://pypi.org/project/django-letsencrypt/
Apache License 2.0
72 stars 9 forks source link

MySQL support problems #10

Closed urda closed 7 years ago

urda commented 7 years ago

Looks like we need to see about moving from TextField to CharField on the model.

Strategy to deal with this:

Traceback

Travis Build

Creating test database for alias 'default'...
Traceback (most recent call last):
  File "runtests.py", line 72, in <module>
    failures = test_runner.run_tests(['letsencrypt'])
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/test/runner.py", line 210, in run_tests
    old_config = self.setup_databases()
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/test/runner.py", line 166, in setup_databases
    **kwargs
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/test/runner.py", line 370, in setup_databases
    serialize=connection.settings_dict.get("TEST", {}).get("SERIALIZE", True),
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/db/backends/base/creation.py", line 368, in create_test_db
    test_flush=not keepdb,
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/core/management/__init__.py", line 120, in call_command
    return command.execute(*args, **defaults)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 222, in handle
    executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/db/migrations/executor.py", line 110, in migrate
    self.apply_migration(states[migration], migration, fake=fake, fake_initial=fake_initial)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/db/migrations/executor.py", line 148, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/db/migrations/migration.py", line 115, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/db/migrations/operations/fields.py", line 201, in database_forwards
    schema_editor.alter_field(from_model, from_field, to_field)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 484, in alter_field
    old_db_params, new_db_params, strict)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 665, in _alter_field
    self.execute(self._create_unique_sql(model, [new_field.column]))
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 111, in execute
    cursor.execute(sql, params)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/db/utils.py", line 98, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 124, in execute
    return self.cursor.execute(query, args)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/MySQLdb/cursors.py", line 250, in execute
    self.errorhandler(self, exc, value)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/MySQLdb/connections.py", line 42, in defaulterrorhandler
    raise errorvalue
django.db.utils.OperationalError: (1170, "BLOB/TEXT column 'challenge' used in key specification without a key length")
denisroldan commented 7 years ago

Hi there! Did you try to remove the existing migrations and creating a new one? That works ;) Maybe it's also interesting to set a max_length limit to the TextField. Cheers!

urda commented 7 years ago

Hi @denisroldan ! Support for this (via squash) #25 and #26 . I just haven't released a new version yet, 1.1.0 will unofficially support it and my 2.0 release will officially support it :)

urda commented 7 years ago

We're all set with the release of v1.1.0, closing issue.