Opened 4 years ago

Closed 4 years ago

#32024 closed Bug (invalid)

AttributeError: 'tuple' object has no attribute 'startswith' — at Version 1

Reported by: ricky Owned by: nobody
Component: Uncategorized Version: 3.1
Severity: Normal Keywords: operations.py, AttributeError: 'tuple' object has no attribute 'startswith'
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes

Description (last modified by Mariusz Felisiak)

manage.py@dev > makemigrations
ssh://root@10.32.109.197:22/proj/env/bin/python3 -u /root/.pycharm_helpers/pycharm/django_manage.py makemigrations /proj/app/mysite
File tracking disabled
Migrations for 'cmdb':

cmdb/migrations/0003_alladdress_device.py

  • Create model alladdress
  • Create model device

Process finished with exit code 0

manage.py@dev > migrate
ssh://root@10.32.109.197:22/proj/env/bin/python3 -u /root/.pycharm_helpers/pycharm/django_manage.py migrate /proj/app/mysite
File tracking disabled
Operations to perform:
  Apply all migrations: admin, auth, cmdb, contenttypes, sessions
Running migrations:
  Applying cmdb.0001_initial...Traceback (most recent call last):
  File "/root/.pycharm_helpers/pycharm/django_manage.py", line 59, in <module>
    run_command()
  File "/root/.pycharm_helpers/pycharm/django_manage.py", line 46, in run_command
    run_module(manage_file, None, '__main__', True)
  File "/usr/local/python3/lib/python3.8/runpy.py", line 207, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/local/python3/lib/python3.8/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/local/python3/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/proj/app/mysite/manage.py", line 22, in <module>
    main()
  File "/proj/app/mysite/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/proj/env/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/proj/env/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/proj/env/lib/python3.8/site-packages/django/core/management/base.py", line 330, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/proj/env/lib/python3.8/site-packages/django/core/management/base.py", line 371, in execute
    output = self.handle(*args, **options)
  File "/proj/env/lib/python3.8/site-packages/django/core/management/base.py", line 85, in wrapped
    res = handle_func(*args, **kwargs)
  File "/proj/env/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 243, in handle
    post_migrate_state = executor.migrate(
  File "/proj/env/lib/python3.8/site-packages/django/db/migrations/executor.py", line 117, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/proj/env/lib/python3.8/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/proj/env/lib/python3.8/site-packages/django/db/migrations/executor.py", line 227, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/proj/env/lib/python3.8/site-packages/django/db/migrations/migration.py", line 124, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/proj/env/lib/python3.8/site-packages/django/db/migrations/operations/models.py", line 92, in database_forwards
    schema_editor.create_model(model)
  File "/proj/env/lib/python3.8/site-packages/django/db/backends/base/schema.py", line 322, in create_model
    sql, params = self.table_sql(model)
  File "/proj/env/lib/python3.8/site-packages/django/db/backends/base/schema.py", line 195, in table_sql
    'table': self.quote_name(model._meta.db_table),
  File "/proj/env/lib/python3.8/site-packages/django/db/backends/base/schema.py", line 145, in quote_name
    return self.connection.ops.quote_name(name)
  File "/proj/env/lib/python3.8/site-packages/django/db/backends/mysql/operations.py", line 176, in quote_name
    if name.startswith("`") and name.endswith("`"):
AttributeError: 'tuple' object has no attribute 'startswith'

Process finished with exit code 1

The following error will be reported as soon as the new environment is submitted (migrate). Please solve it, thank you very much!

Change History (1)

comment:1 by Mariusz Felisiak, 4 years ago

Description: modified (diff)
Resolution: invalid
Status: newclosed

It looks that you set db_table to a tuple instead of string. Please don't use Trac as a support channel. Closing per TicketClosingReasons/UseSupportChannels.

Note: See TracTickets for help on using tickets.
Back to Top