Malcolm Tredinnick wrote:
> 
> On Sat, 2008-02-23 at 16:02 -0600, Michael Hipp wrote:
>> Where in my Django code files can I set the current working directory 
>> (so that it applies to all my code)?
>>
>> I'm trying to make sure that all paths in my Python code are relative 
>> paths. But I think I need to know where I can put the cwd change so that 
>> it runs when Django first comes up.
> 
> No, you don't. What you want to do is set the Python path variable in
> your environment. Have a look at Django's documentation on mod_python
> setup to see how to set that environment variable. That's the standard
> way to do this.

I think we're talking about two different things. I have the PythonPath 
variable set in my httpd.conf file. No problem with imports.

I wasn't speaking of imports.

But I have lots of "data" files that live in and around my Django code 
and I have to access with them with stuff like:

    f = open("somedir/myfile.dat", 'r')

So how do I make those lines look like that instead of having a bunch of 
  absolute paths stuck in there or lots of messy stuff with 
os.path.join(os.path.dirname(__file__)...) in it?

Thanks,
Michael



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

Reply via email to