Compare commits
3
Commits
30cd4a6ce9
...
ce2f1ab592
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce2f1ab592 | ||
|
|
738c92ab17 | ||
|
|
f386e08ef1 |
+45
-1
@@ -15,8 +15,52 @@ Including another URLconf
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
from django.urls import include, path
|
||||
from django.conf.urls.static import static
|
||||
from hypn0 import settings
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
import mimetypes
|
||||
import debug_toolbar
|
||||
from django.views.static import serve
|
||||
|
||||
def _serve_public_root_file(request, path):
|
||||
"""Отдаёт файлы из корня `public` в dev-режиме в utf-8."""
|
||||
response = serve(request, path, document_root=settings.PUBLIC_DIR)
|
||||
content_type, _ = mimetypes.guess_type(path)
|
||||
if content_type:
|
||||
if content_type.startswith('text/'):
|
||||
response['Content-Type'] = f'{content_type}; charset=utf-8'
|
||||
else:
|
||||
response['Content-Type'] = content_type
|
||||
elif path.endswith('.txt'):
|
||||
response['Content-Type'] = 'text/plain; charset=utf-8'
|
||||
elif path.endswith('.html'):
|
||||
response['Content-Type'] = 'text/html; charset=utf-8'
|
||||
return response
|
||||
|
||||
def _iter_public_root_files():
|
||||
"""Находит все обычные файлы в корне `public`, кроме служебных артефактов."""
|
||||
for file_path in sorted(settings.PUBLIC_DIR.iterdir()):
|
||||
if not file_path.is_file():
|
||||
continue
|
||||
if file_path.name.startswith('.'):
|
||||
continue
|
||||
if file_path.name == 'README.md':
|
||||
continue
|
||||
yield file_path.name
|
||||
|
||||
PUBLIC_ROOT_URLPATTERNS = [
|
||||
path(filename, _serve_public_root_file, {'path': filename})
|
||||
for filename in _iter_public_root_files()
|
||||
]
|
||||
|
||||
urlpatterns = [path('__debug__/', include(debug_toolbar.urls)), ] + urlpatterns
|
||||
# urlpatterns = [path('tmp/', views.tmp, name='web_tmp')] + urlpatterns
|
||||
urlpatterns = [*PUBLIC_ROOT_URLPATTERNS, *urlpatterns]
|
||||
urlpatterns += static(settings.STATIC_URL, document_root=settings.PUBLIC_DIR.joinpath('static'))
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="88mm"
|
||||
height="125mm"
|
||||
viewBox="0 0 87.999998 125"
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
|
||||
sodipodi:docname="logo-hypn0.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview7"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#111111"
|
||||
borderopacity="1"
|
||||
inkscape:showpageshadow="0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pagecheckerboard="1"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.78127806"
|
||||
inkscape:cx="89.596782"
|
||||
inkscape:cy="357.74715"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="998"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="649"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1" />
|
||||
<defs
|
||||
id="defs2" />
|
||||
<g
|
||||
inkscape:label="Слой 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<g
|
||||
id="g8556"
|
||||
transform="matrix(0.51550613,0,0,0.49895881,0,-8.5139935e-5)">
|
||||
<path
|
||||
id="path172"
|
||||
style="fill:none;fill-rule:evenodd;stroke:#c71a1a;stroke-width:5.1653;stroke-linecap:round;stroke-dasharray:none;stroke-dashoffset:0.793;stroke-opacity:1"
|
||||
d="m 131.94788,23.563536 c -2.79602,-0.455007 -4.27241,-3.522905 -3.70703,-6.145695 0.81214,-3.767508 4.89177,-5.658812 8.42336,-4.692633 4.71475,1.289866 7.08902,6.597308 5.78838,11.151999 -1.65399,5.792156 -8.07142,8.614196 -13.61025,6.822979 -6.80406,-2.200396 -10.16214,-9.996847 -8.02034,-16.654287 2.56378,-7.969059 11.52539,-11.7937625 19.22175,-9.0869689 9.02919,3.1755504 13.43585,13.6438769 10.37737,22.5400439 -3.53094,10.270417 -15.19739,15.155203 -25.17443,11.464164 -11.36798,-4.205596 -16.87665,-17.493931 -12.84183,-28.742906 1.00935,-2.8140762 2.55978,-5.4164942 4.53388,-7.6375825" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:44.3994px;font-family:'PT Mono';-inkscape-font-specification:'PT Mono Bold';fill:#000000;stroke-width:0.231247"
|
||||
x="4.7239106e-07"
|
||||
y="32.277035"
|
||||
id="text284"
|
||||
transform="scale(0.99548369,1.0045368)"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan282"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:44.3994px;font-family:'PT Mono';-inkscape-font-specification:'PT Mono Bold';stroke-width:0.231247"
|
||||
x="4.7239106e-07"
|
||||
y="32.277035">hypn</tspan></text>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.8 KiB |
Reference in New Issue
Block a user