gpt4 book ai didi

python - manage.py 和 other.py 文件不在同级文件中

转载 作者:太空宇宙 更新时间:2023-11-04 10:54:23 32 4
gpt4 key购买 nike

我有 Django 1.4 和 Python 2.6.6当我使用“django-amdin.py startproject djproject”时,请按照网页中的步骤操作 https://www.ibm.com/developerworks/cn/linux/l-django/#resources我得到如下文件:

djproject/
|-- djproject
| |-- __init__.py
| |-- settings.py
| |-- urls.py
| `-- wsgi.py
`-- manage.py

注意:manage.py 和 other.py 文件不在同级文件夹,为什么?

++++++

DATABASES = {  
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'db/tdata.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.
}
}

当我将“ENGINE”配置为“sqlite3”而不是“django.db.backends.sqlite3”时,出现错误:

django.core.exceptions.ImproperlyConfigured: 'sqlite3' isn't an available database backend.  
Try using django.db.backends.sqlite3 instead.
Error was: No module named base

那也是1.4的新角色吗?

最佳答案

这已更改 in Django 1.4 :

Django 1.4 ships with an updated default project layout and manage.py file for the startproject management command. These fix some issues with the previous manage.py handling of Python import paths that caused double imports, trouble moving from development to deployment, and other difficult-to-debug path issues.

关于python - manage.py 和 other.py 文件不在同级文件中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11078158/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com