白云岛资源网 Design By www.pvray.com

项目一开始的设计很重要,django中app的名称建议用小写

我的博客由两个app组成,Blog和JiaBlog,总觉得不美观,想改成小写的oblog和blog,那么最关键的地方在于和orm数据表的映射

把JiaBlog.articles改成blog.articles是终极目标,这里不推荐用django的migrate

写一个sql批量生成mysql改表名的语句

SELECT
 CONCAT(
 'ALTER TABLE ',
 table_name,
 ' RENAME TO b',
 substring(table_name, 5),
 ';'
 )
FROM
 information_schema.tables Where table_name LIKE 'JiaBlog_%';

这样就批量生成了sql语句

ALTER TABLE JiaBlog_Love RENAME TO blog_Love;
ALTER TABLE JiaBlog_area RENAME TO blog_area;
ALTER TABLE JiaBlog_articlebodypic RENAME TO blog_articlebodypic;
ALTER TABLE JiaBlog_articles RENAME TO blog_articles;
ALTER TABLE JiaBlog_articles_tags RENAME TO blog_articles_tags;
ALTER TABLE JiaBlog_blogauth RENAME TO blog_blogauth;
ALTER TABLE JiaBlog_blogrole RENAME TO blog_blogrole;
ALTER TABLE JiaBlog_bloguser RENAME TO blog_bloguser;
ALTER TABLE JiaBlog_bloguser_role RENAME TO blog_bloguser_role;
ALTER TABLE JiaBlog_blogusercollect RENAME TO blog_blogusercollect;
ALTER TABLE JiaBlog_category RENAME TO blog_category;
ALTER TABLE JiaBlog_codemodel RENAME TO blog_codemodel;
ALTER TABLE JiaBlog_comment RENAME TO blog_comment;
ALTER TABLE JiaBlog_daynumber RENAME TO blog_daynumber;
ALTER TABLE JiaBlog_genre RENAME TO blog_genre;
ALTER TABLE JiaBlog_graduation RENAME TO blog_graduation;
ALTER TABLE JiaBlog_hits RENAME TO blog_hits;
ALTER TABLE JiaBlog_honour RENAME TO blog_honour;
ALTER TABLE JiaBlog_jia RENAME TO blog_jia;
ALTER TABLE JiaBlog_jiafile RENAME TO blog_jiafile;
ALTER TABLE JiaBlog_message RENAME TO blog_message;
ALTER TABLE JiaBlog_movie RENAME TO blog_movie;
ALTER TABLE JiaBlog_note RENAME TO blog_note;
ALTER TABLE JiaBlog_paper RENAME TO blog_paper;
ALTER TABLE JiaBlog_params RENAME TO blog_params;
ALTER TABLE JiaBlog_project RENAME TO blog_project;
ALTER TABLE JiaBlog_recruinfo RENAME TO blog_recruinfo;
ALTER TABLE JiaBlog_recruitment RENAME TO blog_recruitment;
ALTER TABLE JiaBlog_resume RENAME TO blog_resume;
ALTER TABLE JiaBlog_sysrecord RENAME TO blog_sysrecord;
ALTER TABLE JiaBlog_tag RENAME TO blog_tag;
ALTER TABLE JiaBlog_teacher RENAME TO blog_teacher;
ALTER TABLE JiaBlog_userip RENAME TO blog_userip;
ALTER TABLE JiaBlog_version RENAME TO blog_version;
ALTER TABLE JiaBlog_visitnumber RENAME TO blog_visitnumber;

然后其余步骤大概如下
1.修改文件夹名称
2.修改app中views.py内关于models的引用
3.修改app中urls.py内关于app的views.py的引用
4.修改项目settings.pyapp名称
5.修改项目urls.py中include的app名称

白云岛资源网 Design By www.pvray.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
白云岛资源网 Design By www.pvray.com

稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!

昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。

这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。

而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?