List Info

Thread: import settings from application directory




import settings from application directory
user name
2006-11-23 19:53:07
/home/bewater/django/foo_project/settings.py
/home/bewater/django/foo_project/bar_application/myprogram.p
y

'import settings', read the configuration from settings.py.
So if the
script is run from another directory that project's it
fails.

In my case, I need run program from an application
directory. How could
I 'import settings' in this case?

I tried the next, but nothing:
os.chdir('..'); import settings


--~--~---------~--~----~------------~-------~--~----~
 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
-~----------~----~----~----~------~----~------~--~---

import settings from application directory
user name
2006-11-23 20:39:08
Solved! The problem was because I was running 'myprogram.py'
using a
link. So when I was running 'import settings', it was trying
loading it
from the linked directory (where it isn't '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-2]

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