i think it is always good to decouple the imports and INSTALLED_APPS (in settings.py) from projectname.
one way of doing this is ------------------------ a) in INSTALLED_APPS (settings.py) use just APPNAME instead of PROJECTNAME.APPNAME (it still works as the project path is on sys.path which manage.py has added) b) in imports use APPNAME.MODULENAME instead of PROJECTNAME.APPNAME.MODULENAME (it still works as the project path is on sys.path which manage.py has added) when you do the above two things your project apps are decoupled from the PRoject Name (and you can change it freely). ------------------------ AND also to make your project more protable to other systems ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Instead of putting down the absolute paths for TEMPLATES,MEDIA (in settings.py) etc Use the technique illustrated in the below url http://morethanseven.net/2009/02/11/django-settings-tip-setting-relative-paths/ On Feb 13, 9:06 am, Malcolm Tredinnick <malc...@pointy-stick.com> wrote: > On Thu, 2009-02-12 at 19:45 -0800, stevedegrace wrote: > > I think I might have bitten off more than I can chew here, heh, and I > > need some help. I just finished my project and it looks awesome on my > > computer at home (running Ubuntu Intrepid). But before I deployed it, > > I decided I didn't like the retarded name I gave the project and I > > wanted to change it. No problem, I just did this in the project > > directory: > > > $ find ./ -type f -exec perl -pi -e 's/oldname/newname/g' {} \; > > Hmm ... that could have any number of unintended side-effects. Hope that > string didn't accidentally occur anywhere else. > > Just to be safe, I'd certainly make sure I blew away any .pyc files > after doing the above to make sure they were recompiled correctly next > time around. In the longer term, I'd work on removing as many > dependencies on the project name as possible from the code (which should > be pretty much all of them). > > > Worked like a charm, > > !?! Presumably you're talking about the kind of chalm one puts on an > apple before giving it to Snow White, rather than the good kind, based > on what follows in your mail. > > > I've gone through and all the instances have been > > replaced. Changed the name of my sqlite db instead of changing back > > the path to the db in settings.py. > > > Only now when I run: > > > $ python manage.py shell > > > or anything like that, it raises ImportError the first time it hits > > one of my applications in the INSTALLED_APPS list. > > It does more than that. It gives you a huge traceback telling you what > it was trying to import, etc. That information contains the clues about > what went wrong. In particular, the last line will say something like > "no module called....". What's it trying to import and what isn't it > finding that? > > > I looked at the > > code of manage.py and all it seems to do is import settings, it isn't > > obviously adding the project directory to sys.path. That seems to be > > the key missing element here. Aside from hacking my manage.py file to > > make it do what I think it should, how does Django normally figure out > > how to import project modules? > > It just uses the normal Python path, nothing special. The only exception > is that ./manage.py adds the "current" directory (the one containing > manage.py) to the Python path so that project-named imports will work > without people having to learn about Python path. Unfortunate (since it > hides a problem, not fixes one), but it's not a big deal. > > To debug this further, apart from removing the .pyc files, I would also > copy the source files (or do a fresh checkout if you're using version > control) to a new directory and try running "syncdb" again. If that > works, you know the problem is caused by some detritus in the original > directory. If not, you've eliminated one more thing. Really, though, the > import error is going to be the place to start: working out why that > module isn't available. > > Regards, > Malcolm --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---