重命名Django项目的简单方法 [英] Easy way to rename a django project

查看:155
本文介绍了重命名Django项目的简单方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一种简单的方法来重命名项目。该项目有一个我也想重命名的应用程序。当然,如果我将其重命名为文件夹,它将无法使用。我在这里进行了搜索,而Google却找不到答案。谢谢

I would like to know if there is an easy way to rename a project. The project has an app that I would like to also rename. Of course if I rename it the folder, it won't work. I did a search in here and Google and I could not find the answer. Thanks

推荐答案

重命名项目实际上比重命名应用程序容易。 此问题说明了如何重命名应用。

Renaming the project is actually easier than renaming an app. This question explains how to rename an app.

要重命名项目,您需要在出现的任何地方更改项目名称。 grep -nir oldname。可以帮助您找到它的显示位置。就我而言,我必须更改以下位置:

To rename the project, you need to change the project name wherever it appears. grep -nir oldname . can help you find where it appears. In my case, I had to change the following places:


  1. 重命名 oldprojectname 目录到 newprojectname

manage.py :更改 os.environ.setdefault('DJANGO_SETTINGS_MODULE','oldprojectname.settings')

newprojectname / wsgi.py :更改 os.environ.setdefault('DJANGO_SETTINGS_MODULE ','oldprojectname.settings')

newprojectname / settings.py :更改 ROOT_URLCONF ='oldprojectname.urls'并更改 WSGI_APPLICATION ='oldprojectname.wsgi.application'

newprojectname / urls.py :更改oldprojectname在我添加的行中

newprojectname/urls.py: Change oldprojectname in a line I had added

这篇关于重命名Django项目的简单方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆