Re: Link to download a file

2017-09-07 Thread Andréas Kühne
nt-Disposition'] = 'attachment; filename=dati.csv' > return resp > it works! > > > Il giorno giovedì 31 agosto 2017 17:58:27 UTC+2, giuseppe ricci ha scritto: > >> Hi guys, I need some help to insert a link to download a file. In a view >> I read data from

Re: Link to download a file

2017-09-07 Thread giuseppe ricci
-download') resp['Content-Disposition'] = 'attachment; filename=dati.csv' return resp it works! Il giorno giovedì 31 agosto 2017 17:58:27 UTC+2, giuseppe ricci ha scritto: > > Hi guys, I need some help to insert a link to download a file. In a view I > read data from a csv file and I

Re: Link to download a file

2017-09-06 Thread James Schneider
On Wed, Sep 6, 2017 at 6:03 AM, giuseppe ricci wrote: > Thank you James for your reply.. > So in my urls.py I insert a new entry: > > url(r'^download/$', 'views.download') > > and my view to download a file is: > > def download(request): > file_path = 'static/tmp/'

Re: Link to download a file

2017-09-06 Thread giuseppe ricci
insert a link to download a file. In a view I > read data from a csv file and I show them in a table in a template. Under > the table I need to insert, when there are data, > a link similar as Download data and when user click it, he download the > datafile, previously I wrote the

Re: Link to download a file

2017-09-01 Thread James Schneider
On Aug 31, 2017 8:57 AM, "giuseppe ricci" <peppepega...@gmail.com> wrote: Hi guys, I need some help to insert a link to download a file. In a view I read data from a csv file and I show them in a table in a template. Under the table I need to insert, when there are data

Link to download a file

2017-08-31 Thread giuseppe ricci
Hi guys, I need some help to insert a link to download a file. In a view I read data from a csv file and I show them in a table in a template. Under the table I need to insert, when there are data, a link similar as Download data and when user click it, he download the datafile, previously I

Re: Link to download

2017-05-05 Thread 'Abraham Varricatt' via Django users
That's an interesting project! If I use WhiteNoise as part of a production deploy somewhere, can I skip (or ignore) running 'manage.py collectstatic' ? Yours, Abraham V. On Wednesday, 3 May 2017 15:13:36 UTC-4, Dan Tagg wrote: > > You might want to check out WhiteNoise ( >

Re: Link to download

2017-05-03 Thread Dan Tagg
You might want to check out WhiteNoise ( https://whitenoise.readthedocs.io/en/stable/) perhaps in conjunction with a CDN On 3 May 2017 at 19:35, Tim Chase wrote: > On 2017-05-02 19:11, Antonis Christofides wrote: > > response = HttpResponse(csvfile.read(),

Re: Link to download

2017-05-03 Thread Tim Chase
On 2017-05-02 19:11, Antonis Christofides wrote: > response = HttpResponse(csvfile.read(), content_type='text/csv') Beware that, if your content can get huge (some of our reports can run to hundreds of megabytes), you might want to investigate something like the "sendfile" alternatives or spew it

Re: Link to download

2017-05-03 Thread Sixtine Vernhes
It's work with the use of media :) Thanks for the help ! Le mardi 2 mai 2017 18:13:01 UTC+2, Antonis Christofides a écrit : > > You cannot get a file outside of your project unless you symlink it inside > the project. This is also a Very Bad Thing(TM) as it may allow attackers to > request

Re: Link to download

2017-05-02 Thread Antonis Christofides
> You cannot get a file outside of your project unless you symlink it inside the > project. This is also a Very Bad Thing(TM) as it may allow attackers to > request arbitrary files. You /can/ get a file outside your project. Whether this is a bad thing or not depends on why and how. I also don't

Re: Link to download

2017-05-02 Thread m712 - Developer
You cannot get a file outside of your project unless you symlink it inside the project. This is also a Very Bad Thing(TM) as it may allow attackers to request arbitrary files. What you should do instead is this: 1) Put Data/01/export.txt to the static/ folder inside your app (with the same

Re: Link to download

2017-05-02 Thread Sixtine Vernhes
This is in development. I try to send url of my file in views.py : return render(request, "export.html", {'out': urlOut}) and in my template I have the link : Lien du fichier but when I open it I have this link : http://127.0.0.1:8000/home/myuser/Data/01/export.txt and I want to

Re: Link to download

2017-05-02 Thread Antonis Christofides
Is this in production or development? What is the url that doesn't work? What happens when you try the url? Regards, A. Antonis Christofides http://djangodeployment.com On 2017-05-02 11:28, Sixtine Vernhes wrote: > Hi ! > > I try to create a link on Django who download a static csv file, but I

Link to download

2017-05-02 Thread Sixtine Vernhes
Hi ! I try to create a link on Django who download a static csv file, but I have no idea how to do. In my settings.py : STATIC_URL = '/static/' STATICFILES_DIRS = ( os.path.join(BASE_DIR, "static/"), ) and my file is in this directory Would anyone have an idea ? -- You received