List Info

Thread: Configure the environment using the setup_environ function




Configure the environment using the setup_environ function
user name
2006-11-23 15:54:10
I would configure the runtime environment using the function
from
management.py.
And I think that these are the modules to importing, and run
that
function:
--------------------
from django.conf import settings
from django.core.management import setup_environ

setup_environ(settings)
--------------------

But I get the nex error:
AttributeError: 'Settings' object has no attribute
'__file__'


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Configure the environment using the setup_environ function
user name
2006-11-23 17:54:40
#!/usr/bin/env python
from django.core.management import setup_environ
import settings
setup_environ(settings)

a) this needs to bee in a .py file because stdin of an
interactive
interpreter lacks the file path
b) you need to import your project settings (at least
manage.py did id
this way the last time I looked)

Cheers,
/k


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Configure the environment using the setup_environ function
user name
2006-11-23 18:33:21
import settings
ImportError: No module named settings

Is that module of django?


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Configure the environment using the setup_environ function
user name
2006-11-23 19:04:39
I have checked that since ipython I can import settings, and
it's a
Django module.

So I tried since a program with those lines only and it
works so must
be a problem in my program.


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Configure the environment using the setup_environ function
user name
2006-11-23 19:22:36
My script was failling because I built it to be run from the
application directory and not from project directory that is
where is
'settings.py' 


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )