You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
431 B
Python
18 lines
431 B
Python
4 years ago
|
import os.path
|
||
|
|
||
|
from django.views.static import serve
|
||
|
|
||
|
|
||
|
def sendfile(request, filename, **kwargs):
|
||
|
"""
|
||
|
Send file using Django dev static file server.
|
||
|
|
||
|
.. warning::
|
||
|
|
||
|
Do not use in production. This is only to be used when developing and
|
||
|
is provided for convenience only
|
||
|
"""
|
||
|
dirname = os.path.dirname(filename)
|
||
|
basename = os.path.basename(filename)
|
||
|
return serve(request, basename, dirname)
|