On Wed, 2006-08-02 at 14:24 -0700, Dan Shafer wrote: > I'm now starting to build one or two tutorial projects in Django in my > final phase evaluation of it and TurboGears. In preparation, I checked > out of SVN the current trunk and ran through the setup/install > process. I'm on OS X 10.4.7, by the way, and trying to run this > locally with MySQL as the db. > > When I installed Django, it ended up in a deeply buried directory on > my system, but I guess it's the one where Python packages tend to go > (/Library/Python/2.3/site-packages/Django- 0.95-y2.3.egg/django). I > have created a project in django/bin called djproject (following one > tutorial at IBM's DeveloperWorks) and have struggled through the setup > and initialization stuff. I have successfully set up my new database > and have reached the point where I'm supposed to run syncdb. Along the > way, I've had to do a lot of futzing with command-line parameters > because (it appears at least) the Django install didn't properly set > up the PYTHONPATH environment variable for me. Still, I've managed to > get this far. > > Now when I type at a Python prompt: > > from jobs.models import Job > > from within the /djproject/jobs directory, I get a "No module named > jobs.models" error. So I move up to the parent directory (see above > about fiddling with directory locations) and I try the same command > and this generates a Python error: > > EnvironmentError: Environment variable DJANGO_SETTINGS_MODULE is > undefined.
If you want to work with an interactive prompt, the easiest way is to be inside your project directory (jobs/ in your case, I guess) and run "./manage.py shell". This will set up DJANGO_SETTINGS_MODULE and append the current directory to the Python path for you. You could set the DJANGO_SETTINGS_MODULE environment variable yourself (it should point to the Python-importable path to your settings.py file) if you like. That was the old way you had to do it in Django; it got tedious very quickly so it was wrapped in a manage.py option. Regards, Malcolm > > I searched the mailing list archives and other sites and although it > appears that this is not an uncommon problem, the method of fixing it > is sufficiently obtuse to me (as one who is somewhat uncomfortable > still with the *nix command line, though at least not terrified of > it!) that I can't quite dope out how to fix it. > > > I'm loath to move the DJango directory because I've seen that in the > past cause SVN problems that were quite painful. At the same time, > this process of dealing with directories and permissions (somehow > superuser got involved and now I can't even edit files without > multiple steps involving permission) has been getting in the way of my > learning Django, which after all is my objective. > > So my question is would I be better off: (a) starting with the > official version rather than SVNing the dev version; and (b) just > blowing away the Django stuff on my system before I have too much of > it and restart, putting Django in a more accessible directory on which > I have proper permissions? Or am I just missing some little thing that > someone could tell me how to fix easily and I'd be back in the > clover? > > Thanks for helping someone whose problem is probably not completely > Django-specific. > -- > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Dan Shafer, Information Product Consultant and Author > http://www.shafermedia.com > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---