2013/6/5 A T.Khan
> I have already a Django setup running (you guessed it devstack), and it
> works fine. I have done plenty of editing already. But now I want to add a
> download button on a page, and by clicking to it, a file should be
> downloaded. Seems simple enough, but right now what I hav
Maybe a view with something like
def priv_file(request):
if request.user.is_anonymous:
return render_to_response("goaway.html")
else:
path = "Path to file"
data = open(path)
type = "whatever"
return HttpResonse(data, content_type=type)
A T.Khan wr
maybe you could use something like this:
https://docs.djangoproject.com/en/1.1/howto/apache-auth/
On Wed, Jun 5, 2013 at 6:02 PM, Bill Freeman wrote:
> The easiest thing, which you may or may not find to be adequate, is to use
> an "if" tag in the template to do one of:
> Not render the butto
The easiest thing, which you may or may not find to be adequate, is to use
an "if" tag in the template to do one of:
Not render the button if you are not logged in, or
Render a button that has the correct link if you are logged in but links
to a "you must log in" page if you are not, or
Rende
Hello everyone,
I am relatively new on Django, in fact I got to know about it through
Openstack Dashboard which works using Django. anyway I got a question and I
been looking for it for a month now without getting any good results, I
finally decided to ask some of the experts here. If I am viol
So, let me get this straight.
You are trying to serve a 299mb file, directly from your webapp instance?
I'm just gonna come right out and say it... what you are doing is pretty
stupid. I'd look into doing things properly (i.e. serving it from a real web
server) rather than trying to resolve this
... dare I ask, how big is the file?
Cal
On Wed, Apr 27, 2011 at 3:20 PM, Elton Pereira wrote:
> When attempting to download a zip file the following error is raised:
>
> 192.168.1.39 - - [27/Apr/2011 11:12:35] "GET /media/downloads/betha/
> essencial/sybase9/windows32/win32.rar HTTP/1.1" 500 -
When attempting to download a zip file the following error is raised:
192.168.1.39 - - [27/Apr/2011 11:12:35] "GET /media/downloads/betha/
essencial/sybase9/windows32/win32.rar HTTP/1.1" 500 -
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/django/core/servers/
ba
Karen,
> ...It sounds like the problem is you have set up the results from
> this view to be cached, yet this response cannot be cached as it
> contains a file...
Got it; thanks so much. You were exactly right. Not only had I
forgotten that I'd set up project-wide caching for this testbed
On Sun, Nov 1, 2009 at 8:44 AM, birkin wrote:
>
> I forgot to note that the referenced mod_wsgi error is from the apache
> error log; it is *not* a django exception. But because of the nearly
> identical working code, I am suspecting my issue is with my django
> code.
>
>
I'm not sure what you me
I forgot to note that the referenced mod_wsgi error is from the apache
error log; it is *not* a django exception. But because of the nearly
identical working code, I am suspecting my issue is with my django
code.
-Birkin
On Nov 1, 7:21 am, birkin wrote:
> ...
> The error:
>
> mod_wsgi (pid=1196
I expect the following views.py file-download code to work, but am
getting an error, and would like feedback.
The function:
def item( request, item_id ):
from django.http import HttpResponse, HttpResponseNotFound
## valid-item check
if not item_id == '123':
return HttpRespon
Are you trying to get your source code off a server, and instead find
it being executed by the webserver?
If you have shell access, tar the files up and download that, create a
folder where the files aren't executable and download them that
way.
If it is your source, I would assume you have
Hello. This is probably a silly question but I have files being stored
onto a server and strangely getting them there was very easy but how
can I get them back down?
Thank you for your patience in advance,
Sam
--~--~-~--~~~---~--~~
You received this message becaus
On May 14, 5:16 pm, Bob Dively <[EMAIL PROTECTED]> wrote:
> The file is sent to the browser (Firefox), which understands the
> mimetype correctly and hands the file off to Excel. However, Excel
> says that the file is in an unrecognized format. When I open the file
> with Excel, it's garbled. The
Hi all. Another n00b question. I'm trying to send an Excel file to the
user thusly:
fullpath = os.path.join('C:/', 'text.xls')
response = HttpResponse(file(fullpath).read(), mimetype='application/
vnd.ms-excel')
response['Content-disposition'] = 'Attachment; filename=extract.xls'
return response
16 matches
Mail list logo