简体   繁体   English

将python django项目1.3升级到1.5

[英]upgrading python django project 1.3 to 1.5

currently i have python project using django version 1.3 running on mountain lion OS and now i want to upgrade it to django 1.5. 目前我有使用django 1.3版在山狮OS上运行的python项目,现在我想将它升级到django 1.5。 But when i put it and try to do python manage.py runserver i get an error saying 但是,当我把它并尝试做python manage.py runserver我得到一个错误说

Error: Can't find the file 'settings.py' in the directory containing 'manage.py'. 错误:在包含'manage.py'的目录中找不到文件'settings.py'。 It appears you've customized things. 看来你已经定制了东西。 You'll have to run django-admin.py, passing it your settings module. 您必须运行django-admin.py,并将其传递给您的设置模块。 (If the file settings.py does indeed exist, it's causing an ImportError somehow.) (如果文件settings.py确实存在,则会以某种方式导致ImportError。)

i realized that the project structure is different, is there any way to convert or upgrading the 1.3 project into 1.5 project somehow? 我意识到项目结构不同,有什么方法可以将1.3项目转换或升级到1.5项目?

Every Django release has release note with upgrading instructions. 每个Django版本都有发布说明和升级说明。

  1. Upgrade your project to Django 1.4 . 将您的项目升级到Django 1.4
  2. Upgrade your project to Django 1.5 . 将您的项目升级到Django 1.5

Unfortunately the process is not automated, so you'll have to carefully go through both documents. 不幸的是,这个过程并不是自动化的,因此您必须仔细检查这两个文档。

To elaborate on what kirelagin mentioned, the project structure and layout has changed in 1.4 so you need to reflect that in your setup. 要详细说明kirelagin提到的内容,项目结构和布局在1.4中已经改变,因此您需要在设置中反映出来。 You can see the notes on this in the release documentation : 您可以在发布文档中查看相关说明:

Django 1.4 ships with an updated default project layout and manage.py file for the startproject management command. Django 1.4附带了一个更新的默认项目布局和managepropy管理命令的manage.py文件。 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处理,从开发到部署的麻烦以及其他难以调试的路径问题的一些问题。

This will mean there is a conflict in where Django expects your settings.py to be. 这意味着Django期望你的settings.py存在冲突。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM