2013-06-04 64 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是一個衝突。