Re: DJANGO_SETTINGS_MODULE ERROR using Django models from python shell
Hi everybody (specially Malcom), After a long period, I had time to delte the unecessary variables and test it. So, finally, the goes the list of settigns you must include on you default settings file in order to use you application models outside Django web context (a python server side script for instance). gettext_noop = lambda s: s DATABASE_OPTIONS = {} URL_VALIDATOR_USER_AGENT = "Django/0.96pre (http://www.djangoproject.com)" It works on my actual project. Good luck! Tkm On 5/11/07, Bruno Tikami <[EMAIL PROTECTED]> wrote: > > Malcolm, it works > > > Thanks a lot, I shall delete the unecessary global settings. > > TKS!!! > > > Tkm > > On 5/11/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > > > > Hi Bruno, > > > > On Fri, 2007-05-11 at 11:11 -0300, Bruno Tikami wrote: > > > Hello Malcolm > > > > > > Thanks for you fast reply > > > > > > I'll try to put the missing settings on my project.settings . Do I > > > have to call configure() in some diferent way after I do that? I mean, > > > if my settings have all the global settings... > > > > No. The first argument to configure() is a class or a module, so that > > the code can access each of the settings as an attribute. So if you > > project settings contains every single global setting, you will be able > > to pass that in (boy is that going to be a big file, though). Note that > > you may not actually need every single global setting, but you will need > > a fair chunk of them, I expect. > > > > 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: DJANGO_SETTINGS_MODULE ERROR using Django models from python shell
Malcolm, it works Thanks a lot, I shall delete the unecessary global settings. TKS!!! Tkm On 5/11/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > Hi Bruno, > > On Fri, 2007-05-11 at 11:11 -0300, Bruno Tikami wrote: > > Hello Malcolm > > > > Thanks for you fast reply > > > > I'll try to put the missing settings on my project.settings . Do I > > have to call configure() in some diferent way after I do that? I mean, > > if my settings have all the global settings... > > No. The first argument to configure() is a class or a module, so that > the code can access each of the settings as an attribute. So if you > project settings contains every single global setting, you will be able > to pass that in (boy is that going to be a big file, though). Note that > you may not actually need every single global setting, but you will need > a fair chunk of them, I expect. > > 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: DJANGO_SETTINGS_MODULE ERROR using Django models from python shell
Hi Bruno, On Fri, 2007-05-11 at 11:11 -0300, Bruno Tikami wrote: > Hello Malcolm > > Thanks for you fast reply > > I'll try to put the missing settings on my project.settings . Do I > have to call configure() in some diferent way after I do that? I mean, > if my settings have all the global settings... No. The first argument to configure() is a class or a module, so that the code can access each of the settings as an attribute. So if you project settings contains every single global setting, you will be able to pass that in (boy is that going to be a big file, though). Note that you may not actually need every single global setting, but you will need a fair chunk of them, I expect. 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: DJANGO_SETTINGS_MODULE ERROR using Django models from python shell
Hello Malcolm Thanks for you fast reply I'll try to put the missing settings on my project.settings . Do I have to call configure() in some diferent way after I do that? I mean, if my settings have all the global settings... On 5/11/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > On Fri, 2007-05-11 at 22:53 +1000, Malcolm Tredinnick wrote: > [...] > > Manual configuration isn't really designed to make it trivial to specify > > your normal settings file and some overrides like you are trying to do > > here. > > I should point out that there wasn't really any technical reason for > this decision and it's not because we're mean people. We just didn't > think that there might be a lot of use-cases when you wouldn't want to > specify all the changes from default yourself. Running scripts, however, > is the obvious one we forgot about. > > So if you (or anybody else) wants to come up with a backward-compatible > change that allows for specifying a module that is laid over the top of > global_settings and then have the keyword args applied, go for it. Open > a ticket with the patch and I will give it serious consideration. > > 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: DJANGO_SETTINGS_MODULE ERROR using Django models from python shell
On Fri, 2007-05-11 at 22:53 +1000, Malcolm Tredinnick wrote: [...] > Manual configuration isn't really designed to make it trivial to specify > your normal settings file and some overrides like you are trying to do > here. I should point out that there wasn't really any technical reason for this decision and it's not because we're mean people. We just didn't think that there might be a lot of use-cases when you wouldn't want to specify all the changes from default yourself. Running scripts, however, is the obvious one we forgot about. So if you (or anybody else) wants to come up with a backward-compatible change that allows for specifying a module that is laid over the top of global_settings and then have the keyword args applied, go for it. Open a ticket with the patch and I will give it serious consideration. 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: DJANGO_SETTINGS_MODULE ERROR using Django models from python shell
On Fri, 2007-05-11 at 09:41 -0300, Bruno Tikami wrote: > Hi! > > I'm trying to use Django models from a python script and I'm having > some settings problem. Even though I called settings.configure, it > keeps ordering for some other setting parameter. The error is listed > below. Any idea? > > > > $ python > >>> import recorder > >>> import recorder.settings > >>> from django.conf import settings > >>> settings.configure(recorder.settings, DEBUG=True) The first argument here is the global defaults dictionary. Normally, Django will take your settings file and merge it with django.conf.global_settings, however, if you are using manual configuration, you need to make sure that every single default setting is given a value. This is documented in the manual configuration section, although we may need to put it in big red flashing lights, because it gets overlooked. Manual configuration isn't really designed to make it trivial to specify your normal settings file and some overrides like you are trying to do here. One way to do this, though, is to read through your settings file yourself and put all the options into a dictionary (say settings_dict), then call settings.configure(**dict(settings_dict, DEBUG=True)) Alternatively, create a file that combines your settings with global_settings and then use that as the replacement global (the first positional arg in the settings.configure() call). 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---