I changed the app name to backend, and things are working great now.
The process is not easy, so I noted the steps required.  I did not know
if there was an automated way to do this, if there is -- please let me
know.

1. rename the directory under apps directory to your new app name
2. edit /apps/yournewapp/models/__init__.py and change the only line
there to reflect the name of your new application

The following changes are to be done in the database:

1. Change all tables names that have your app name to the new app's
name.  For example, if you have a model called 'widget', then (I am
using MySQL) :

ALTER TABLE `yourprojectname`.`oldappname_widgets` RENAME TO
`yourprojectname`.`newappname_widgets`;

Note that the table name always is the plural form of your model name.
You can easily script the operation above if you like.  If you have a
lot of models, then you will have to change a lot of tables.

2. Change the content_types table and replace any instance of
youroldapp with yournewapp in the package column.  The following sample
query does the trick:

UPDATE TABLE `yourprojectname`.`content_types` SET `package` =
'yournewapp' WHERE `package` = 'youroldapp';

Note:  If your application is called 'admin' (like mine was). You need
to alter the query a bit because the 'log entry' content type should
belong to the built-in admin module.  To do this, I actually used the
following query:

UPDATE TABLE `containers`.`content_type` SET `package` = 'backend'
WHERE (`package` = 'admin' AND `name` != 'log entry');

3. Finally, change the packages table and replace references to your
old app name with your new app name.  This is an easy replace:

UPDATE TABLE `projectname`.`packages` SET `label` = 'newappname',
`name` = 'newappname' WHERE `label` = 'oldappname' LIMIT 1;

That's it.  Save your database changes and the administration section
should work.

Reply via email to