I'm having this lines in every table in my db. I'm using django 1.8.
pub_date = models.DateTimeField(default=datetime.datetime.now)
author = models.ForeignKey(settings.AUTH_USER_MODEL)
I also tried the code below and I get the same error.
author = models.ForeignKey(User)
This is what I see in terminal using syncdb
.
cy_thal
is the name of my db.
C:\Python27\Lib\site-packages\django\core\management\commands\syncdb.py:24: Remo
vedInDjango19Warning: The syncdb command will be removed in Django 1.9
warnings.warn("The syncdb command will be removed in Django 1.9", RemovedInDja
ngo19Warning)
Operations to perform:
Synchronize unmigrated apps: chartit, pagination, staticfiles, autocomplete_li
ght, messages, bootstrap3_datetime, eReg, crispy_forms, bootstrap3
Apply all migrations: admin, contenttypes, auth, sessions
Synchronizing apps without migrations:
Creating tables...
Creating table eReg_demographic
Creating table eReg_icd_10
Creating table eReg_pregnancy
Creating table eReg_diagnosis
Creating table eReg_clinical_data
Creating table eReg_clinical_data_two
Creating table eReg_a_b_sickle_thal
Creating table eReg_redcell_enzyme_dis
Creating table eReg_redcell_membrane_dis
Creating table eReg_cong_dyseryth_anaemia
Creating table eReg_ext_centers
Running deferred SQL...
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Python27\Lib\site-packages\django\core\management\__init__.py", line
338, in execute_from_command_line
utility.execute()
File "C:\Python27\Lib\site-packages\django\core\management\__init__.py", line
330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\Lib\site-packages\django\core\management\base.py", line 390,
in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Python27\Lib\site-packages\django\core\management\base.py", line 441,
in execute
output = self.handle(*args, **options)
File "C:\Python27\Lib\site-packages\django\core\management\commands\syncdb.py"
, line 25, in handle
call_command("migrate", **options)
File "C:\Python27\Lib\site-packages\django\core\management\__init__.py", line
120, in call_command
return command.execute(*args, **defaults)
File "C:\Python27\Lib\site-packages\django\core\management\base.py", line 441,
in execute
output = self.handle(*args, **options)
File "C:\Python27\Lib\site-packages\django\core\management\commands\migrate.py
", line 179, in handle
created_models = self.sync_apps(connection, executor.loader.unmigrated_apps)
File "C:\Python27\Lib\site-packages\django\core\management\commands\migrate.py
", line 317, in sync_apps
cursor.execute(statement)
File "C:\Python27\Lib\site-packages\django\db\backends\utils.py", line 79, in
execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "C:\Python27\Lib\site-packages\django\db\backends\utils.py", line 64, in
execute
return self.cursor.execute(sql, params)
File "C:\Python27\Lib\site-packages\django\db\utils.py", line 97, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "C:\Python27\Lib\site-packages\django\db\backends\utils.py", line 62, in
execute
return self.cursor.execute(sql)
File "C:\Python27\Lib\site-packages\django\db\backends\mysql\base.py", line 12
4, in execute
return self.cursor.execute(query, args)
File "C:\Python27\Lib\site-packages\MySQLdb\cursors.py", line 174, in execute
self.errorhandler(self, exc, value)
File "C:\Python27\Lib\site-packages\MySQLdb\connections.py", line 36, in defau
lterrorhandler
raise errorclass, errorvalue
django.db.utils.OperationalError: (1005, "Can't create table 'cy_thal.#sql-f8c_9
' (errno: 150)")
Do you have any idea how to fix this?
Thank you in advance!