On Mon, 19 Feb 2007 15:58:37 -0500, Veloz <[EMAIL PROTECTED]> wrote:
> > Hi there > > A couple weeks back I evaluated Django under Python 2.4. I followed > the installation instructions and all went well. > > Recently we upgraded from python 2.4 on the server to python 2.5, and > at that point, my Django stopped working. > > (The 2.4 version of Python came either installed with Fedora Core 4, > or perhaps via yum at a later time. 2.5 was put on there by me by > doing the configure/make/install cycle this morning) > > I assumed the problem was because Django had been installed into the > site-packages of my 2.4 python installation (which is in /usr/lib) and > now my newest python is running out out of /usr/local/lib) and its > site-package directory does not contain Django. (I'm guessing that was > the problem) > > Anyway, so I used svn to download Django into my python 2.5 directory, > but now when I run django-admin.py its complaining about not finding > the DJANGO_SETTINGS_MODULE env variable. I read up on this and am > confused because: > > 1. Why did I not get this error before when I tried Django under 2.4 > (was there something that was automatically configured for me with > regard to DJANGO_SETTINGS_MODULE that is no longer automatically set > now that I'm using a compiled version of Python?) I don't why, as I don't know exactly what you did different this time (but neither do you or you wouldn't be asking). Generally, I only use django-admin.py to start a new project. Once the basic directory structure is created, I cd into that dir and use manage.py which will automatically configure the DJANGO_SETTINGS_MODULE to settings.py in the current directory. Perhaps that's what you did before. In case you don't know, manage.py is basically a wrapper around django-admin.py that takes care of the settings for you, so you can use it the same way minus the headaches of setting the DJANGO_SETTINGS_MODULE. Type `manage.py help` for a full list of commands. > > 2. I'm a bit confused about the purpose and use of > DJANGO_SETTINGS_MODULE (I have read the docs). If you host multiple > sites, how can you tell Django about all their configuration files > with just one environment variable? I must be missing the boat here. The trick is that environment variables are loaded when a python session starts. Within that python session you can make any changes you want to the environment variables without those changes rolling back to the actual OS environment. Therefore, the first thing manage.py does, for example, is set `os.environ['DJANGO_SETTINGS_MODULE']` to settings.py of the current working directory. As mod_python and fcgi (the most common ways to deploy django) both load django as a long running process (simply stated), that setting is preserved within that project only. For example, mod_python has a `SetEnv` directive where the DJANGO_SETTINGS_MODULE` can be defined for a specific project. For more, I suggest reading the docs[1]. [1]: http://www.djangoproject.com/documentation/settings/ > > Any input related to the above topics would be greatly appreciated. At > this point my progress on my project has come to a screeching halt. > > Thanks! > Michael > > > > -- Waylan Limberg [EMAIL PROTECTED] --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---