Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
news
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sartika Aritonang
news
Commits
fff5719a
Commit
fff5719a
authored
May 29, 2020
by
Sartika Aritonang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
71ea68a6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
static.py
stbi/Lib/site-packages/django/conf/urls/static.py
+28
-0
No files found.
stbi/Lib/site-packages/django/conf/urls/static.py
0 → 100644
View file @
fff5719a
import
re
from
urllib.parse
import
urlsplit
from
django.conf
import
settings
from
django.core.exceptions
import
ImproperlyConfigured
from
django.urls
import
re_path
from
django.views.static
import
serve
def
static
(
prefix
,
view
=
serve
,
**
kwargs
):
"""
Return a URL pattern for serving files in debug mode.
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
# ... the rest of your URLconf goes here ...
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
"""
if
not
prefix
:
raise
ImproperlyConfigured
(
"Empty static prefix not permitted"
)
elif
not
settings
.
DEBUG
or
urlsplit
(
prefix
)
.
netloc
:
# No-op if not in debug mode or a non-local prefix.
return
[]
return
[
re_path
(
r'^
%
s(?P<path>.*)$'
%
re
.
escape
(
prefix
.
lstrip
(
'/'
)),
view
,
kwargs
=
kwargs
),
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment