python - Django says that table doesn't exist while it does -
my ultimate goal deploy django application on new server , have raw image of disk of old server. have set on new server: uwsgi, python, mysql, django etc. let's problem: when run
uwsgi --http :8001 --module propotolki.wsgi
it runs without errors when try access through browser following stack trace in logs:
internal server error: / traceback (most recent call last): file "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 90, in get_response response = middleware_method(request) file "./apps/middleware/middleware.py", line 11, in process_request if redirecthandler.objects.filter(is_active=true, redirect_from=request.path).exists(): file "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 512, in exists return self.query.has_results(using=self.db) file "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/query.py", line 409, in has_results return bool(compiler.execute_sql(single)) file "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 781, in execute_sql cursor.execute(sql, params) file "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py", line 53, in execute return self.cursor.execute(sql, params) file "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 99, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) file "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py", line 53, in execute return self.cursor.execute(sql, params) file "/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 124, in execute return self.cursor.execute(query, args) file "/usr/local/lib/python2.7/dist-packages/mysqldb/cursors.py", line 205, in execute self.errorhandler(self, exc, value) file "/usr/local/lib/python2.7/dist-packages/mysqldb/connections.py", line 36, in defaulterrorhandler raise errorclass, errorvalue programmingerror: (1146, "table 'propotolki.middleware_redirecthandler' doesn't exist")
here's mysql console, proving table does exist:
mysql> show databases; +--------------------+ | database | +--------------------+ | information_schema | | mysql | | performance_schema | | propotolki | +--------------------+ 4 rows in set (0.00 sec) mysql> use propotolki; reading table information completion of table , column names can turn off feature quicker startup -a database changed mysql> show tables; +---------------------------------------+ | tables_in_propotolki | +---------------------------------------+ | auth_group | | auth_group_permissions | | auth_permission | | auth_user | | auth_user_groups | | auth_user_user_permissions | | bla_files_blafile | | bla_files_sitefiles | | calc_anglealum | | calc_anglesteelwhite | | calc_baseheight | | calc_cellsize | | calc_color | | calc_outgo_bc_25 | | calc_pendant | | calc_price | | calc_roofcolor | | calc_size | | catalog_brand | | catalog_category | | catalog_colortemperature | | catalog_diffuser | | catalog_floortype | | catalog_lightoutput | | catalog_order | | catalog_orderinfo | | catalog_product | | catalog_product_categories | | catalog_product_color_temperature | | catalog_product_diffuser | | catalog_product_floor_type | | catalog_product_light_output | | catalog_product_related | | catalog_product_related_categories | | catalog_productsliderimage | | catalog_sessionbasket | | chunks_chunk | | chunks_group | | chunks_image | | chunks_media | | django_admin_log | | django_content_type | | django_ipgeobase_ipgeobase | | django_ipgeobase_ipgeobase_city | | django_ipgeobase_ipgeobase_country | | django_ipgeobase_ipgeobase_region | | django_session | | django_site | | feedback_feedback | | gallery_gallerygroup | | gallery_galleryimage | | left_menu_leftmenuitem | | middleware_breadcrumbs | | middleware_flatpages | | middleware_redirecthandler | | middleware_slidebar | | propotolki.django_content_type | | propotolki.middleware_redirecthandler | | south_migrationhistory | | thumbnail_kvstore | | watson_searchentry | +---------------------------------------+ 61 rows in set (0.01 sec)
i far being django expert, please ask needed info. tried doing python manager.py syncdb
similar error telling other tables doesn't exist:
# python manage.py syncdb syncing... creating tables ... traceback (most recent call last): file "manage.py", line 9, in <module> execute_from_command_line(sys.argv) file "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 399, in execute_from_command_line utility.execute() file "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute self.fetch_command(subcommand).run_from_argv(self.argv) file "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 242, in run_from_argv self.execute(*args, **options.__dict__) file "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 285, in execute output = self.handle(*args, **options) file "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 415, in handle return self.handle_noargs(**options) file "/usr/local/lib/python2.7/dist-packages/south/management/commands/syncdb.py", line 92, in handle_noargs syncdb.command().execute(**options) file "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 285, in execute output = self.handle(*args, **options) file "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 415, in handle return self.handle_noargs(**options) file "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/syncdb.py", line 112, in handle_noargs emit_post_sync_signal(created_models, verbosity, interactive, db) file "/usr/local/lib/python2.7/dist-packages/django/core/management/sql.py", line 216, in emit_post_sync_signal interactive=interactive, db=db) file "/usr/local/lib/python2.7/dist-packages/django/dispatch/dispatcher.py", line 185, in send response = receiver(signal=self, sender=sender, **named) file "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/management/__init__.py", line 82, in create_permissions ctype = contenttype.objects.db_manager(db).get_for_model(klass) file "/usr/local/lib/python2.7/dist-packages/django/contrib/contenttypes/models.py", line 47, in get_for_model defaults = {'name': smart_text(opts.verbose_name_raw)}, file "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 154, in get_or_create return self.get_queryset().get_or_create(**kwargs) file "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 373, in get_or_create return self.get(**lookup), false file "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 301, in num = len(clone) file "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 77, in __len__ self._fetch_all() file "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 854, in _fetch_all self._result_cache = list(self.iterator()) file "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 220, in iterator row in compiler.results_iter(): file "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 710, in results_iter rows in self.execute_sql(multi): file "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 781, in execute_sql cursor.execute(sql, params) file "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py", line 53, in execute return self.cursor.execute(sql, params) file "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 99, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) file "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py", line 53, in execute return self.cursor.execute(sql, params) file "/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 124, in execute return self.cursor.execute(query, args) file "/usr/local/lib/python2.7/dist-packages/mysqldb/cursors.py", line 205, in execute self.errorhandler(self, exc, value) file "/usr/local/lib/python2.7/dist-packages/mysqldb/connections.py", line 36, in defaulterrorhandler raise errorclass, errorvalue django.db.utils.programmingerror: (1146, "table 'propotolki.django_content_type' doesn't exist")
how did table names end '.' in them? it's special character.
| propotolki.django_content_type | | propotolki.middleware_redirecthandler |
try:
alter table `propotolki.middleware_redirecthandler` rename middleware_redirecthandler
you need same django_content_type
table too.
Comments
Post a Comment