
v^                 @   sq   d  Z  d d l Z d d l Z d d l m Z d d l m Z d d l m Z d d l	 m
 Z
 d d d	  Z d S)
z
Views and functions for serving static files. These are only to be used during
development, and SHOULD NOT be used in a production setting.

    N)settings)finders)Http404)staticFc             K   s   t  j r | r t  t j |  j d  } t j |  } | s{ | j d  s_ | d k rk t d   t d |   t	 j
 j |  \ } } t j |  | d | | S)as  
    Serve static files below a given point in the directory structure or
    from locations inferred from the staticfiles finders.

    To use, put a URL pattern such as::

        from django.contrib.staticfiles import views

        path('<path:path>', views.serve)

    in your URLconf.

    It uses the django.views.static.serve() view to serve the found files.
    / z'Directory indexes are not allowed here.z'%s' could not be founddocument_root)r   DEBUGr   	posixpathnormpathlstripr   findendswithospathsplitr   serve)requestr   ZinsecurekwargsZnormalized_pathZabsolute_pathr    r   B/tmp/pip-build-8lau8j11/django/django/contrib/staticfiles/views.pyr      s    r   )__doc__r   r
   Zdjango.confr   Zdjango.contrib.staticfilesr   Zdjango.httpr   Zdjango.viewsr   r   r   r   r   r   <module>   s   