hi
I have a  django project at /home/dev/python/django/myproject .In an
app in this project I have some utility programs which has a file
writing function.


----myproject/myapp/utilities/filewritingutility.py----
def write_to_file(filename,data):
     with open(filename,'w') as f:
        f.write(data)

this function is called by another view function.

----myproject/myapp/views.py----
def record_inputdata(request,..):
    data=get_data_from_user()
     write_to_file('myfile.txt',data)


When the record_inputdata() is  executed, the file 'myfile.txt' is
created in the myproject folder.Why is this?How does python determine
the file location?Suppose I want to create the file in some other
folder ,say myproject/myapp/data how should I make the changes to the
code?
 I have the same doubt about reading the  file also. In another
function in the myapp/utilities/filereadutility.py ,when I call
get_data_from_file(somefilename) ,python looks at the myproject folder
for this file.How can I change this?

thanks
jim

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to