2013-06-04 67 views
5

目前我有python项目使用django版本1.3运行山狮子操作系统,现在我想升级到Django 1.5。但是,当我把它和尝试做python manage.py runserver我得到一个错误说升级python django项目1.3到1.5

Error: Can't find the file 'settings.py' in the directory containing 'manage.py'. It appears you've customized things. You'll have to run django-admin.py, passing it your settings module. (If the file settings.py does indeed exist, it's causing an ImportError somehow.)

我意识到,项目结构是不同的,有什么办法转换或升级1.3项目到1.5项目不知何故?

回答

6

每个Django版本都有发布说明和升级说明。

  1. Upgrade your project to Django 1.4
  2. Upgrade your project to Django 1.5

不幸的是,这个过程并不是自动的,所以你必须仔细阅读这两份文件。

+0

我看..好吧,谢谢kirelagin! –

+0

OP得到的具体错误不应该出现在Django 1.5中。发行说明说:*“(老式的manage.py将继续像以前一样工作,直到Django 1.6,在1.5中它将引发DeprecationWarning)。”* – gertvdijk

+0

@gertvdijk这也是我的想法。但实际上,问题是关于升级,而不是修复错误。无论如何,在升级过程中,OP填充必须重构他的项目和。最有可能的是,错误将消失。 – kirelagin

1

为了详细说明kirelagin提到的是什么,项目结构和布局在1.4中进行了更改,因此您需要在您的设置中反映这一点。你可以看到这个笔记the release documentation

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.

这将意味着有在Django的期待您的settings.py是一个冲突。