djano 1.8.3 python manage.py迁移Linux

时间:2015-08-10 04:45:11

标签: python mysql linux django

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/core/management/__init__.py", line 330, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/core/management/base.py", line 393, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/core/management/base.py", line 443, in execute
    self.check()
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/core/management/base.py", line 481, in check
    include_deployment_checks=include_deployment_checks,
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/core/checks/registry.py", line 72, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/core/checks/model_checks.py", line 28, in check_all_models
    errors.extend(model.check(**kwargs))
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/db/models/base.py", line 1181, in check
    errors.extend(cls._check_fields(**kwargs))
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/db/models/base.py", line 1258, in _check_fields
    errors.extend(field.check(**kwargs))
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/db/models/fields/__init__.py", line 934, in check
    errors = super(AutoField, self).check(**kwargs)
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/db/models/fields/__init__.py", line 207, in check
    errors.extend(self._check_backend_specific_checks(**kwargs))
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/db/models/fields/__init__.py", line 306, in _check_backend_specific_checks
    return connection.validation.check_field(self, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/db/backends/mysql/validation.py", line 18, in check_field
    field_type = field.db_type(connection)
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/db/models/fields/__init__.py", line 614, in db_type
    return connection.data_types[self.get_internal_type()] % data
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/db/__init__.py", line 36, in __getattr__
    return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/utils/functional.py", line 60, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/db/backends/mysql/base.py", line 196, in data_types
    if self.features.supports_microsecond_precision:
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/utils/functional.py", line 60, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/db/backends/mysql/features.py", line 52, in supports_microsecond_precision
    return self.connection.mysql_version >= (5, 6, 4) and Database.version_info >= (1, 2, 5)
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/utils/functional.py", line 60, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/db/backends/mysql/base.py", line 371, in mysql_version
    with self.temporary_connection():
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/db/backends/base/base.py", line 462, in temporary_connection
    cursor = self.cursor()
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/db/backends/base/base.py", line 162, in cursor
    cursor = self.make_debug_cursor(self._cursor())
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/db/backends/base/base.py", line 135, in _cursor
    self.ensure_connection()
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/db/backends/base/base.py", line 130, in ensure_connection
    self.connect()
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/db/utils.py", line 97, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/db/backends/base/base.py", line 130, in ensure_connection
    self.connect()
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/db/backends/base/base.py", line 119, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg/django/db/backends/mysql/base.py", line 276, in get_new_connection
    conn = Database.connect(**conn_params)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 81, in Connect
    return Connection(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 187, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
django.db.utils.OperationalError: (1049, "Unknown database '/home/workspace/django/mysite/db.mysql'")

我在settings.py中的数据库设置是

'ENGINE': 'django.db.backends.mysql',
'NAME':os.path.join(BASE_DIR, 'jangoo'),  #<--idk what to type here  
'USER':'root',                            #I created a database 
'PASSWORD':'1234',                        # named jangoo in mysql  
'HOST':'127.0.0.1'

1 个答案:

答案 0 :(得分:1)

数据库设置中的

名称大多数是db的名称

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'test',
        'USER': 'root',
        'PASSWORD': '123567',
        'HOST': 'localhost',   # Or an IP Address that your DB is hosted on
        'PORT': '3306',
        'OPTIONS': {"init_command": "SET storage_engine=MyISAM"},
    }
}