> I've done some coding on the project and within myapp > > but now I want to rename myapp to a more appropriate name. > > of course I cant simply rename the generated application directory > name, I would also need to change all references to the myapp. > > So, then question is, do I need to do this all manually, or is there a > django function or easier way for me to easily rename an application > properly?
Short answer: not readily. One detail you omit is what platform you're running on. Your *nix-like systems have some tools to make this a bit easier for you. It also depends on how interdependent your project and apps are on each other, as well as how you reference things After backing up my project (well, checking into my revision control system, mercurial in the current case), I'd just do bash$ cd /path/to/wherever bash$ find . -name '*.py' -exec sed -i.bak \ -e '/import/s/myapp/mynewapp/' \ -e 's/myapp\./mynewapp\./g' \ {} \; bash$ sed -i.bak 's/myapp/mynewapp/g' settings.py bash$ cd .. bash$ mv myapp mynewapp which should catch most of the cases as well as create *.bak files for you to compare and/or restore if something went wrong. The "find+sed" should catch the following cases: import myapp from myapp import foo, bar, baz myapp.Foo.whatever = myapp.SOME_VALUE and the last sed call cleans up some of the additional instances of "myapp" in your settings.py file (a glorified search&replace). This assumes you'll be rebuilding your database, as your tables are currently named things like "myapp_mymodel". Other caveats include direct app-model/table references in .extra() calls and places where you use the app-name in strings with no following period (like in the settings.py, thus the extra hand-treatment). Additionally, if you follow the sage advice of James, and your "project" just consists of a settings.py and a base urls.py, you'll want to execute the above find+sed statement in your app directory, and the single sed statement in the project directory. Those are at least a few of the gotchas that occur to me, but it should ease the process of renaming. -tim --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---