Working through the introductory Django project tutorial on the official site. I have successfully installed the CyMySQL 0.5.5 connector through pip. The server status is "Running". For the command python manage.py syncdb this is what powershell returns. Could this have something to do with the DATABASES section of settings.py file having wrong parameters? :
C:\Python33\lib\site-packages\win32\lib\pywintypes.py:39: DeprecationWarning: imp.get_suffixes() is deprecated; use
constants defined on importlib.machinery instead
for suffix_item in imp.get_suffixes():
Traceback (most recent call last):
File "C:\Python33\lib\site-packages\django\db\backends\mysql\base.py", line 14, in <module>
import MySQLdb as Database
ImportError: No module named 'MySQLdb'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Python33\lib\site-packages\django\core\management\__init__.py", line 399, in execute_from_command_line
utility.execute()
File "C:\Python33\lib\site-packages\django\core\management\__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python33\lib\site-packages\django\core\management\base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\Python33\lib\site-packages\django\core\management\base.py", line 280, in execute
translation.activate('en-us')
File "C:\Python33\lib\site-packages\django\utils\translation\__init__.py", line 130, in activate
return _trans.activate(language)
File "C:\Python33\lib\site-packages\django\utils\translation\trans_real.py", line 188, in activate
_active.value = translation(language)
File "C:\Python33\lib\site-packages\django\utils\translation\trans_real.py", line 177, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "C:\Python33\lib\site-packages\django\utils\translation\trans_real.py", line 159, in _fetch
app = import_module(appname)
File "C:\Python33\Lib\importlib\__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
File "<frozen importlib._bootstrap>", line 1022, in load_module
File "<frozen importlib._bootstrap>", line 1003, in load_module
File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper
File "<frozen importlib._bootstrap>", line 868, in _load_module
File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
File "C:\Python33\lib\site-packages\django\contrib\admin\__init__.py", line 6, in <module>
from django.contrib.admin.sites import AdminSite, site
File "C:\Python33\lib\site-packages\django\contrib\admin\sites.py", line 4, in <module>
from django.contrib.admin.forms import AdminAuthenticationForm
File "C:\Python33\lib\site-packages\django\contrib\admin\forms.py", line 6, in <module>
from django.contrib.auth.forms import AuthenticationForm
File "C:\Python33\lib\site-packages\django\contrib\auth\forms.py", line 17, in <module>
from django.contrib.auth.models import User
File "C:\Python33\lib\site-packages\django\contrib\auth\models.py", line 48, in <module>
class Permission(models.Model):
File "C:\Python33\lib\site-packages\django\db\models\base.py", line 96, in __new__
new_class.add_to_class('_meta', Options(meta, **kwargs))
File "C:\Python33\lib\site-packages\django\db\models\base.py", line 264, in add_to_class
value.contribute_to_class(cls, name)
File "C:\Python33\lib\site-packages\django\db\models\options.py", line 124, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "C:\Python33\lib\site-packages\django\db\__init__.py", line 34, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "C:\Python33\lib\site-packages\django\db\utils.py", line 198, in __getitem__
backend = load_backend(db['ENGINE'])
File "C:\Python33\lib\site-packages\django\db\utils.py", line 113, in load_backend
return import_module('%s.base' % backend_name)
File "C:\Python33\Lib\importlib\__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Python33\lib\site-packages\django\db\backends\mysql\base.py", line 17, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named 'MySQLdb'
Please use django-cymysql and latest cymysql
djang-cymysql https://github.com/nakagami/django-cymysql/
cymysql 0.7.2 https://pypi.python.org/pypi/cymysql/0.7.2
and use 'mysql_cymysql' ENGINE
Related
I was trying to update mi DB using the comand
python manage.py makemigrations
after of delete all the files of migrations in my Django project, because when I try to do the changes on my db doesnt apply
This is my model
class ciudades(models.Model):
ciudad_nombre = models.CharField(max_length=50)
estado = models.CharField(max_length=50)
def __str__(self):
return self.name
class Meta:
db_table = 'ciudades'
verbose_name ='Ciudad'
verbose_name_plural = 'Ciudades'
This is the error that I get
Traceback (most recent call last):
File "/Users/dorianraygoza/Downloads/doha-erp/manage.py", line 22, in <module>
main()
File "/Users/dorianraygoza/Downloads/doha-erp/manage.py", line 19, in main
execute_from_command_line(sys.argv)
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 395, in execute
django.setup()
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/apps/config.py", line 124, in create
mod = import_module(mod_path)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/contrib/auth/apps.py", line 8, in <module>
from .checks import check_models_permissions, check_user_model
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/contrib/auth/checks.py", line 8, in <module>
from .management import _get_builtin_permissions
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/contrib/auth/management/__init__.py", line 9, in <module>
from django.contrib.contenttypes.management import create_contenttypes
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/contrib/contenttypes/management/__init__.py", line 2, in <module>
from django.db import (
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/db/migrations/__init__.py", line 1, in <module>
from .migration import Migration, swappable_dependency # NOQA
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'django.db.migrations.migration'
❯ python manage.py makemigrations
Traceback (most recent call last):
File "/Users/dorianraygoza/Downloads/doha-erp/manage.py", line 22, in <module>
main()
File "/Users/dorianraygoza/Downloads/doha-erp/manage.py", line 19, in main
execute_from_command_line(sys.argv)
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 395, in execute
django.setup()
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/apps/config.py", line 124, in create
mod = import_module(mod_path)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/contrib/auth/apps.py", line 8, in <module>
from .checks import check_models_permissions, check_user_model
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/contrib/auth/checks.py", line 8, in <module>
from .management import _get_builtin_permissions
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/contrib/auth/management/__init__.py", line 9, in <module>
from django.contrib.contenttypes.management import create_contenttypes
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/contrib/contenttypes/management/__init__.py", line 2, in <module>
from django.db import (
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/db/migrations/__init__.py", line 1, in <module>
from .migration import Migration, swappable_dependency # NOQA
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'django.db.migrations.migration'
❯ python3 manage.py makemigrations
Traceback (most recent call last):
File "/Users/dorianraygoza/Downloads/doha-erp/manage.py", line 22, in <module>
main()
File "/Users/dorianraygoza/Downloads/doha-erp/manage.py", line 19, in main
execute_from_command_line(sys.argv)
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 395, in execute
django.setup()
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/apps/config.py", line 124, in create
mod = import_module(mod_path)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/contrib/auth/apps.py", line 8, in <module>
from .checks import check_models_permissions, check_user_model
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/contrib/auth/checks.py", line 8, in <module>
from .management import _get_builtin_permissions
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/contrib/auth/management/__init__.py", line 9, in <module>
from django.contrib.contenttypes.management import create_contenttypes
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/contrib/contenttypes/management/__init__.py", line 2, in <module>
from django.db import (
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/db/migrations/__init__.py", line 1, in <module>
from .migration import Migration, swappable_dependency # NOQA
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'django.db.migrations.migration'
❯ python -m django --version
3.2.6
❯ pip install --upgrade --force-reinstall Django==3.2.6
Collecting Django==3.2.6
Using cached Django-3.2.6-py3-none-any.whl (7.9 MB)
Collecting asgiref<4,>=3.3.2
Downloading asgiref-3.6.0-py3-none-any.whl (23 kB)
Collecting pytz
Downloading pytz-2022.7.1-py2.py3-none-any.whl (499 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 499.4/499.4 kB 3.0 MB/s eta 0:00:00
Collecting sqlparse>=0.2.2
Downloading sqlparse-0.4.3-py3-none-any.whl (42 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 42.8/42.8 kB 3.6 MB/s eta 0:00:00
Installing collected packages: pytz, sqlparse, asgiref, Django
Attempting uninstall: pytz
Found existing installation: pytz 2021.1
Uninstalling pytz-2021.1:
Successfully uninstalled pytz-2021.1
Attempting uninstall: sqlparse
Found existing installation: sqlparse 0.4.2
Uninstalling sqlparse-0.4.2:
Successfully uninstalled sqlparse-0.4.2
Attempting uninstall: asgiref
Found existing installation: asgiref 3.4.1
Uninstalling asgiref-3.4.1:
Successfully uninstalled asgiref-3.4.1
Attempting uninstall: Django
Found existing installation: Django 3.2.6
Uninstalling Django-3.2.6:
Successfully uninstalled Django-3.2.6
Successfully installed Django-3.2.6 asgiref-3.6.0 pytz-2022.7.1 sqlparse-0.4.3
[notice] A new release of pip available: 22.3.1 -> 23.0
❯ python manage.py makemigrations
Traceback (most recent call last):
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/db/backends/mysql/base.py", line 73, in execute
return self.cursor.execute(query, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/MySQLdb/cursors.py", line 206, in execute
res = self._query(query)
^^^^^^^^^^^^^^^^^^
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/MySQLdb/cursors.py", line 319, in _query
db.query(q)
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/MySQLdb/connections.py", line 254, in query
_mysql.connection.query(self, query)
MySQLdb.ProgrammingError: (1146, "Table 'dohaerp_db.ciudades' doesn't exist")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/dorianraygoza/Downloads/doha-erp/manage.py", line 22, in <module>
main()
File "/Users/dorianraygoza/Downloads/doha-erp/manage.py", line 19, in main
execute_from_command_line(sys.argv)
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 395, in execute
django.setup()
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/apps/registry.py", line 114, in populate
app_config.import_models()
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/apps/config.py", line 301, in import_models
self.models_module = import_module(models_module_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/Users/dorianraygoza/Downloads/doha-erp/apps/home/models.py", line 197, in <module>
for i in ciudades.objects.all():
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/db/models/query.py", line 280, in __iter__
self._fetch_all()
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/db/models/query.py", line 1324, in _fetch_all
self._result_cache = list(self._iterable_class(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/db/models/query.py", line 51, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1175, in execute_sql
cursor.execute(sql, params)
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 98, in execute
return super().execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 66, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 79, in _execute
with self.db.wrap_database_errors:
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/django/db/backends/mysql/base.py", line 73, in execute
return self.cursor.execute(query, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/MySQLdb/cursors.py", line 206, in execute
res = self._query(query)
^^^^^^^^^^^^^^^^^^
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/MySQLdb/cursors.py", line 319, in _query
db.query(q)
File "/Users/dorianraygoza/Downloads/doha-erp/venv/lib/python3.11/site-packages/MySQLdb/connections.py", line 254, in query
_mysql.connection.query(self, query)
django.db.utils.ProgrammingError: (1146, "Table 'dohaerp_db.ciudades' doesn't exist")
I delete all migrations files to update de DB and still doesnt work
I try making a new data base to run new migrations but still give me the same error
I Already solve this
It was a query on the models file, lain Shelvington comment helps me to find this error
for i in ciudades.objects.all():
origen_quotes.append((i.ciudad_nombre, i.ciudad_nombre))
destino_quotes.append((i.ciudad_nombre, i.ciudad_nombre))
So I just comment that part of code and its works fine, that was because in this table I use was created after of the makemigrations command, so the CRM doesnt find the table, but when I comment and run the command
python manage.py makemigrations
and
python manage.py migrate
It works
This is my first question. I'll try to get it right.
After having no problems running Django on my dev environment (on macOS 10.14.6) for over a year, I tried to start the server today and got this message:
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x10e2d62f0>
With this traceback:
Traceback (most recent call last):
File "/Users/mtd83/_Dev/env/lib/python3.4/site-packages/django/db/backends/mysql/base.py", line 25, in <module>
import MySQLdb as Database
File "/Users/mtd83/_Dev/env/lib/python3.4/site-packages/MySQLdb/__init__.py", line 19, in <module>
import _mysql
ImportError: dlopen(/Users/mtd83/_Dev/env/lib/python3.4/site-packages/_mysql.so, 2): Library not loaded: /usr/local/opt/mysql-connector-c/lib/libmysqlclient.18.dylib
Referenced from: /Users/mtd83/_Dev/env/lib/python3.4/site-packages/_mysql.so
Reason: image not found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/mtd83/_Dev/env/lib/python3.4/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/Users/mtd83/_Dev/env/lib/python3.4/site-packages/django/core/management/commands/runserver.py", line 113, in inner_run
autoreload.raise_last_exception()
File "/Users/mtd83/_Dev/env/lib/python3.4/site-packages/django/utils/autoreload.py", line 249, in raise_last_exception
six.reraise(*_exception)
File "/Users/mtd83/_Dev/env/lib/python3.4/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/Users/mtd83/_Dev/env/lib/python3.4/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/Users/mtd83/_Dev/env/lib/python3.4/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/mtd83/_Dev/env/lib/python3.4/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/Users/mtd83/_Dev/env/lib/python3.4/site-packages/django/apps/config.py", line 199, in import_models
self.models_module = import_module(models_module_name)
File "/Users/mtd83/_Dev/env/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "/Users/mtd83/_Dev/env/lib/python3.4/site-packages/django/contrib/auth/models.py", line 4, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/Users/mtd83/_Dev/env/lib/python3.4/site-packages/django/contrib/auth/base_user.py", line 52, in <module>
class AbstractBaseUser(models.Model):
File "/Users/mtd83/_Dev/env/lib/python3.4/site-packages/django/db/models/base.py", line 119, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "/Users/mtd83/_Dev/env/lib/python3.4/site-packages/django/db/models/base.py", line 316, in add_to_class
value.contribute_to_class(cls, name)
File "/Users/mtd83/_Dev/env/lib/python3.4/site-packages/django/db/models/options.py", line 214, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "/Users/mtd83/_Dev/env/lib/python3.4/site-packages/django/db/__init__.py", line 33, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/Users/mtd83/_Dev/env/lib/python3.4/site-packages/django/db/utils.py", line 211, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Users/mtd83/_Dev/env/lib/python3.4/site-packages/django/db/utils.py", line 115, in load_backend
return import_module('%s.base' % backend_name)
File "/Users/mtd83/_Dev/env/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Users/mtd83/_Dev/env/lib/python3.4/site-packages/django/db/backends/mysql/base.py", line 28, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Users/mtd83/_Dev/env/lib/python3.4/site-packages/_mysql.so, 2): Library not loaded: /usr/local/opt/mysql-connector-c/lib/libmysqlclient.18.dylib
Referenced from: /Users/mtd83/_Dev/env/lib/python3.4/site-packages/_mysql.so
Reason: image not found
The problem probably has to do with some edits I made yesterday. I was trying to update Homebrew and I got a message that I had to change ownership and permissions to three files. Unfortunately I didn't take notes on what they were. It involed chown with the -R option.
Also, if it's any help, I've alway had to use sudo before manage.py runserver 80.
Sorry, I know this is pretty vague. Any help would be really appreciated.
I've checked that I have a live mysql server, database created, and ran pip freeze to ensure that mysqlclient is installed.The only error I see is that Mysqlclient isn't connected but I can see that mysqlclient==1.4.6 is installed and is in my requirement.txt file.
**I am running in a virtual environment
My settings.py is as follows:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'bradynce_crm',
'USER': 'root',
'PASSWORD': 'password',
'HOST': '127.0.0.1',
'PORT': '3306',
}
}
I try to run the server and get this error:
Exception ignored in thread started by: <function check_errors.<locals>.wrapper at 0x10d5271f0>
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/utils/autoreload.py", line 248, in raise_last_exception
raise _exception[1]
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/core/management/__init__.py", line 337, in execute
autoreload.check_errors(django.setup)()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/apps/registry.py", line 112, in populate
app_config.import_models()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/apps/config.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/contrib/auth/models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/contrib/auth/base_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/db/models/base.py", line 101, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/db/models/base.py", line 305, in add_to_class
value.contribute_to_class(cls, name)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/db/models/options.py", line 203, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/db/__init__.py", line 33, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/db/utils.py", line 202, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/db/utils.py", line 110, in load_backend
return import_module('%s.base' % backend_name)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 17, in <module>
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?
I am trying to migrate my changes in my existing Django project to mysql database using command python3 manage.py migrate. I transferred to a new MacBook with Catalina OS and installed everything from scatch. When I try to run the command I keep on getting this error trace stack:
The main cause of this error is this line: Library not loaded: libssl.1.1.dylib
Traceback (most recent call last):
File "/Users/vincegonzales/Documents/Anteriore/Project Apps/bonggakaday_api/venv/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 15, in <module>
import MySQLdb as Database
File "/Users/vincegonzales/Documents/Anteriore/Project Apps/bonggakaday_api/venv/lib/python3.7/site-packages/MySQLdb/__init__.py", line 18, in <module>
from . import _mysql
ImportError: dlopen(/Users/vincegonzales/Documents/Anteriore/Project Apps/bonggakaday_api/venv/lib/python3.7/site-packages/MySQLdb/_mysql.cpython-37m-darwin.so, 2): Library not loaded: libssl.1.1.dylib
Referenced from: /Users/vincegonzales/Documents/Anteriore/Project Apps/bonggakaday_api/venv/lib/python3.7/site-packages/MySQLdb/_mysql.cpython-37m-darwin.so
Reason: image not found
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/Users/vincegonzales/Documents/Anteriore/Project Apps/bonggakaday_api/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/Users/vincegonzales/Documents/Anteriore/Project Apps/bonggakaday_api/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 357, in execute
django.setup()
File "/Users/vincegonzales/Documents/Anteriore/Project Apps/bonggakaday_api/venv/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/vincegonzales/Documents/Anteriore/Project Apps/bonggakaday_api/venv/lib/python3.7/site-packages/django/apps/registry.py", line 112, in populate
app_config.import_models()
File "/Users/vincegonzales/Documents/Anteriore/Project Apps/bonggakaday_api/venv/lib/python3.7/site-packages/django/apps/config.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/vincegonzales/Documents/Anteriore/Project Apps/bonggakaday_api/rest_api/models.py", line 3, in <module>
from django.contrib.auth.models import User
File "/Users/vincegonzales/Documents/Anteriore/Project Apps/bonggakaday_api/venv/lib/python3.7/site-packages/django/contrib/auth/models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/Users/vincegonzales/Documents/Anteriore/Project Apps/bonggakaday_api/venv/lib/python3.7/site-packages/django/contrib/auth/base_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "/Users/vincegonzales/Documents/Anteriore/Project Apps/bonggakaday_api/venv/lib/python3.7/site-packages/django/db/models/base.py", line 101, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "/Users/vincegonzales/Documents/Anteriore/Project Apps/bonggakaday_api/venv/lib/python3.7/site-packages/django/db/models/base.py", line 305, in add_to_class
value.contribute_to_class(cls, name)
File "/Users/vincegonzales/Documents/Anteriore/Project Apps/bonggakaday_api/venv/lib/python3.7/site-packages/django/db/models/options.py", line 203, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "/Users/vincegonzales/Documents/Anteriore/Project Apps/bonggakaday_api/venv/lib/python3.7/site-packages/django/db/__init__.py", line 33, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/Users/vincegonzales/Documents/Anteriore/Project Apps/bonggakaday_api/venv/lib/python3.7/site-packages/django/db/utils.py", line 202, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Users/vincegonzales/Documents/Anteriore/Project Apps/bonggakaday_api/venv/lib/python3.7/site-packages/django/db/utils.py", line 110, in load_backend
return import_module('%s.base' % backend_name)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Users/vincegonzales/Documents/Anteriore/Project Apps/bonggakaday_api/venv/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 20, in <module>
) from err
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?
I'm using mysql as a db and I'm getting a django.db.utils.OperationalError: (1054, "Unknown column 'commons_smsmessages.sent_date' in 'field list'") when I add a field to the a pre-existing model. How do I fix it?
I tried python manage.py makemigrations and I've also tried deleting all the migration files and running python manage.py makemigrations but it doesn't seem to work.
This is the model I'm trying to update/add a field to:
class SMSMessages(models.Model):
sms_number_to = models.CharField(max_length=14)
sms_content = models.CharField(max_length=160)
sender_company = models.ForeignKey("SMSUser", on_delete=models.PROTECT, related_name="company_that_sent", limit_choices_to=1)
sent_date = models.DateTimeField(auto_now=True)
class Meta:
verbose_name_plural = "SMSMessages"
def __str__(self):
return self.sender_company
The field I'm trying to add to the model is sent_date. But whenever I run python manage.py makemigrations I get the error
Traceback (most recent call last):
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 71, in execute
return self.cursor.execute(query, args)
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/MySQLdb/cursors.py", line 209, in execute
res = self._query(query)
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/MySQLdb/cursors.py", line 315, in _query
db.query(q)
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/MySQLdb/connections.py", line 226, in query
_mysql.connection.query(self, query)
MySQLdb._exceptions.OperationalError: (1054, "Unknown column 'commons_smsmessages.sent_date' in 'field list'")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/core/management/base.py", line 361, in execute
self.check()
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/core/management/base.py", line 390, in check
include_deployment_checks=include_deployment_checks,
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/core/management/base.py", line 377, in _run_checks
return checks.run_checks(**kwargs)
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/core/checks/registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/core/checks/urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/core/checks/urls.py", line 23, in check_resolver
return check_method()
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/urls/resolvers.py", line 399, in check
for pattern in self.url_patterns:
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/utils/functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/urls/resolvers.py", line 584, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/utils/functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/urls/resolvers.py", line 577, in urlconf_module
return import_module(self.urlconf_name)
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api/urls.py", line 23, in <module>
path("", include('commons.urls')),
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/commons/urls.py", line 8, in <module>
from commons.apiviews import TypeList, TypeDetail, SMSPriceList, SMSPriceDetail, SMSUserCreate, SMSUserUpdate
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/commons/apiviews.py", line 135, in <module>
class SMSMessagesView(generics.ListCreateAPIView):
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/commons/apiviews.py", line 142, in SMSMessagesView
if not queryset:
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/db/models/query.py", line 278, in __bool__
self._fetch_all()
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/db/models/query.py", line 1242, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/db/models/query.py", line 55, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1100, in execute_sql
cursor.execute(sql, params)
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 99, in execute
return super().execute(sql, params)
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 71, in execute
return self.cursor.execute(query, args)
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/MySQLdb/cursors.py", line 209, in execute
res = self._query(query)
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/MySQLdb/cursors.py", line 315, in _query
db.query(q)
File "/home/gadd/vscodeworkspace/sms.et/api.sms.et/api_env/lib/python3.6/site-packages/MySQLdb/connections.py", line 226, in query
_mysql.connection.query(self, query)
django.db.utils.OperationalError: (1054, "Unknown column 'commons_smsmessages.sent_date' in 'field list'")
What I was expecting is the python manage.py makemigrations to successfully run, update my db, and add the column to the model/table.
So I've have solved right after posting the question. so turns out, God know why, if you use the model you're trying to update anywhere then django will throw the above error (again God knows why). So I commented out the code blocks that use the above model in the views.py, serializer.py, apiviews.py etc etc files and run python manage.py makemigrations, It worked.
I left here just in-case someone else runs into this problem.