You should just be able to use a relative path, i.e.
"./static/dbbackup/backup.csv" rather than
"C:/Users/me/Desktop/web2py/applications/webapp1/static/dbbackup/backup.csv".

("../" would take you to one folder above where you started, and "../../"
would go two folder levels up. )

You may need to set up the folder structure appropriately first.

I hope that's somewhat helpful!

Thanks,
Francis

On Tue, 23 Oct 2018, 19:44 mostwanted, <godirao...@gmail.com> wrote:

> I have a folder in my desktop that contains a CSV file that backs up
> information everytime something gets saved into the database. What i wanna
> know is how can I instead have this folder and CSV backup file saved in the
> app somewhere so that even if i relocate the application or take it online
> i don't have redefine the folder path or have it missing because the path
> was not defined correctly.
>
> *CONTROLLER SAVING TO THE EXTERNAL CSV FILE:*
> def index():
>     form=SQLFORM(db.Customer)
>     if form.accepts(request.vars, session):
>         customer=db(db.Customer).select(db.Customer.ALL)
>         #db.export_to_csv_file(open('C:/Users/me/Desktop/backup/backup.csv',
> 'wb'))
>         customer.export_to_csv_file(open(
> 'C:/Folder1/Backup/Client_Bookings_Backup.csv', 'wb'))
>         response.flash = T("CLIENT BOOKED")
>     elif form.errors:
>         response.flash = T("BOOKING FAILED! Please observe the form!")
>     return locals()
>
> Regards:
>
> Mostwanted
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to