Hi,
I would recommend that you checkout how django uses storage backends. The
reason for that is that if you would like to use your application with a
cloud provider that has a storage solution - for example S3, your code
won't work the way it is written now.
However if you just make some minor c
Thanks.
My solution:
urls.py
url(r'^download/$', 'views.download', name='download'),
template.html
Download dei datiIndietro
views.py
def download(request):
data = open(os.path.join(settings.MEDIA_ROOT, 'static/tmp/dati.csv'),
'r').read()
resp = HttpResponse(data, mimetype='application/x-downl
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/' #settings.MEDIA_ROOT
> return r
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/' #settings.MEDIA_ROOT
return render_to_response('download.html', file_path+'dati.csv')
and the downloa
On Aug 31, 2017 8:57 AM, "giuseppe ricci" 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,
a link similar as Download data and when user clic
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 (
> https://whitenoise.
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(), content_type='text/csv')
>
> Beware tha
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
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 arb
> 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 th
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
folde
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 hav
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
13 matches
Mail list logo