0

我已经进行了搜索,但没有找到答案。请帮忙!

这就是我所做的:

(holistic)chris@notebook:~/workspace$ django-admin --version
1.4
(holistic)chris@notebook:~/workspace$ django-admin startproject holistc
(holistic)chris@notebook:~/workspace$ cd holistc/
(holistic)chris@notebook:~/workspace/holistc$ vim settings.py 
(holistic)chris@notebook:~/workspace/holistc$ python manage.py startapp main
(holistic)chris@notebook:~/workspace/holistc$ python manage.py syncdb
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/chris/.virtualenvs/holistic/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/home/chris/.virtualenvs/holistic/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/chris/.virtualenvs/holistic/local/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/chris/.virtualenvs/holistic/local/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/home/chris/.virtualenvs/holistic/local/lib/python2.7/site-packages/django/core/management/base.py", line 371, in handle
    return self.handle_noargs(**options)
  File "/home/chris/.virtualenvs/holistic/local/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 57, in handle_noargs
    cursor = connection.cursor()
  File "/home/chris/.virtualenvs/holistic/local/lib/python2.7/site-packages/django/db/backends/dummy/base.py", line 15, in complain
    raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

这是我的settings.py

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 'holistic_db',                      # Or path to database file if using sqlite3.
        'USER': '',                      # Not used with sqlite3.
        'PASSWORD': '',                  # Not used with sqlite3.
        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
    }
}

任何值得赞赏的想法。谢谢。

4

1 回答 1

1

在 django 1.4 中,设置文件的路径是workspace/holistc/holistc/settings.py.

这与以前版本的 django 不同。您可以在此处阅读有关新项目布局的信息。

于 2012-08-18T11:48:02.610 回答