From 23d1234f8343a9e38197dc05b0ebc594534386d3 Mon Sep 17 00:00:00 2001 From: Lukas Winkler Date: Tue, 2 Jun 2020 20:10:37 +0200 Subject: [PATCH] asset management --- .gitignore | 1 + acronomy/settings.py | 36 +----- acros/management/commands/markdown.py | 2 +- acros/management/commands/scss.py | 30 +++++ acros/templates/acros/detail.html | 6 +- poetry.lock | 43 ++++--- pyproject.toml | 2 +- static/{ => images}/ads.ico | Bin static/images/ads.png | Bin 0 -> 1511 bytes static/{ => images}/arxiv.ico | Bin static/images/arxiv.png | Bin 0 -> 1100 bytes static/libs/autocomplete.min.js | 1 + static/libs/bootstrap.min.js | 1 + static/libs/jquery.slim.min.js | 1 + static/libs/popper.min.js | 1 + static/libs/tagify.min.js | 1 + static/{login.css => scss/_login.scss} | 0 static/scss/_variables.scss | 1 + static/scss/main.scss | 152 +++++++++++++++++++++++++ static/style.css | 106 ----------------- templates/base.html | 15 +-- 21 files changed, 229 insertions(+), 170 deletions(-) create mode 100644 acros/management/commands/scss.py rename static/{ => images}/ads.ico (100%) create mode 100644 static/images/ads.png rename static/{ => images}/arxiv.ico (100%) create mode 100644 static/images/arxiv.png create mode 120000 static/libs/autocomplete.min.js create mode 120000 static/libs/bootstrap.min.js create mode 120000 static/libs/jquery.slim.min.js create mode 120000 static/libs/popper.min.js create mode 120000 static/libs/tagify.min.js rename static/{login.css => scss/_login.scss} (100%) create mode 100644 static/scss/_variables.scss create mode 100644 static/scss/main.scss delete mode 100644 static/style.css diff --git a/.gitignore b/.gitignore index 9ffeffe..c92b4e1 100644 --- a/.gitignore +++ b/.gitignore @@ -113,3 +113,4 @@ node_modules/ acronyms.txt media/ acronomy/secrets.py +static/css diff --git a/acronomy/settings.py b/acronomy/settings.py index 31f4b45..b1918fb 100644 --- a/acronomy/settings.py +++ b/acronomy/settings.py @@ -36,7 +36,6 @@ INSTALLED_APPS = [ 'debug_toolbar', 'rest_framework', 'bootstrap4', - "cachalot" ] MIDDLEWARE = [ @@ -115,26 +114,14 @@ MEDIA_URL = '/media/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, "static"), - os.path.join(BASE_DIR, 'node_modules', 'bootstrap', 'dist'), - os.path.join(BASE_DIR, 'node_modules', 'jquery', 'dist'), - os.path.join(BASE_DIR, 'node_modules', 'popper.js', 'dist'), - os.path.join(BASE_DIR, 'node_modules', '@trevoreyre'), - os.path.join(BASE_DIR, 'node_modules', '@yaireo', 'tagify', 'dist'), - os.path.join(BASE_DIR, 'node_modules', 'codemirror') ] +# STATICFILES_STORAGE = "django.contrib.staticfiles.storage.ManifestStaticFilesStorage" + INTERNAL_IPS = [ '127.0.0.1', ] -if Production: - CACHES = { - 'default': { - 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', - 'LOCATION': '127.0.0.1:11211', - } - } - TAGGIT_CASE_INSENSITIVE = True SECURE_BROWSER_XSS_FILTER = True @@ -148,22 +135,3 @@ if Production: SECURE_HSTS_INCLUDE_SUBDOMAINS = True SESSION_COOKIE_SECURE = True CSRF_COOKIE_SECURE = True - -if DEBUG: - DEBUG_TOOLBAR_PANELS = [ - 'debug_toolbar.panels.versions.VersionsPanel', - 'debug_toolbar.panels.timer.TimerPanel', - 'debug_toolbar.panels.settings.SettingsPanel', - 'debug_toolbar.panels.headers.HeadersPanel', - 'debug_toolbar.panels.request.RequestPanel', - 'debug_toolbar.panels.sql.SQLPanel', - 'debug_toolbar.panels.staticfiles.StaticFilesPanel', - 'debug_toolbar.panels.templates.TemplatesPanel', - 'debug_toolbar.panels.cache.CachePanel', - 'debug_toolbar.panels.signals.SignalsPanel', - 'debug_toolbar.panels.logging.LoggingPanel', - 'debug_toolbar.panels.redirects.RedirectsPanel', - 'debug_toolbar.panels.profiling.ProfilingPanel', - ] # default - - DEBUG_TOOLBAR_PANELS.append("cachalot.panels.CachalotPanel") diff --git a/acros/management/commands/markdown.py b/acros/management/commands/markdown.py index 0130d82..58a7e89 100644 --- a/acros/management/commands/markdown.py +++ b/acros/management/commands/markdown.py @@ -1,7 +1,7 @@ from django.core.management.base import BaseCommand from acros.models import Acronym -from acros.utils import md_to_html +from acros.utils.conversion import md_to_html class Command(BaseCommand): diff --git a/acros/management/commands/scss.py b/acros/management/commands/scss.py new file mode 100644 index 0000000..5d30363 --- /dev/null +++ b/acros/management/commands/scss.py @@ -0,0 +1,30 @@ +from pathlib import Path + +import sass +from django.core.management.base import BaseCommand + + +class Command(BaseCommand): + help = 'compile scss' + + def handle(self, *args, **kwargs): + basedir = Path(__file__).resolve().parent.parent.parent.parent + + inputdir = basedir / "static/scss/" + inputfile = inputdir / "main.scss" + outputfile = basedir / "static/css/main.css" + sourcemap = outputfile.with_suffix(".css.map") + with inputfile.open() as f: + sass_text = f.read() + + css,sourcemap_text = sass.compile( + filename=str(inputfile), + output_style="compressed", + include_paths=[str(inputdir), str(basedir)], + source_map_filename=str(sourcemap) + ) + + with outputfile.open("w") as f: + f.write(css) + with sourcemap.open("w") as f: + f.write(sourcemap_text) diff --git a/acros/templates/acros/detail.html b/acros/templates/acros/detail.html index 5628663..258b804 100644 --- a/acros/templates/acros/detail.html +++ b/acros/templates/acros/detail.html @@ -61,11 +61,11 @@

{{ paper.authors }}

Admin-Edit -{# Edit#} + {# Edit#} {% endblock %} diff --git a/poetry.lock b/poetry.lock index e2ec220..bfdc1c9 100644 --- a/poetry.lock +++ b/poetry.lock @@ -163,18 +163,6 @@ django = ">=2.2,<4.0" python = "<3.8" version = ">=1.5.0,<2.0.0" -[[package]] -category = "main" -description = "Caches your Django ORM queries and automatically invalidates them." -name = "django-cachalot" -optional = false -python-versions = "*" -version = "2.2.0" - -[package.dependencies] -Django = ">=1.11" -six = ">=1.13" - [[package]] category = "main" description = "A configurable set of panels that display various debug information about the current request/response." @@ -266,6 +254,17 @@ zipp = ">=0.5" docs = ["sphinx", "rst.linker"] testing = ["packaging", "importlib-resources"] +[[package]] +category = "main" +description = "Sass for Python: A straightforward binding of libsass for Python." +name = "libsass" +optional = false +python-versions = "*" +version = "0.20.0" + +[package.dependencies] +six = "*" + [[package]] category = "main" description = "Python implementation of Markdown." @@ -424,7 +423,7 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] testing = ["jaraco.itertools", "func-timeout"] [metadata] -content-hash = "bdfe2e7b4c2741554f3480b96ef5e05b9940b06c5520832e2dd7e98351c15be6" +content-hash = "cdcdcb111c5b517e781302c281d1bc1af54fb423475aa09b2632b407692d155c" python-versions = ">=3.7,<4.0" [metadata.files] @@ -517,9 +516,6 @@ django-bootstrap4 = [ {file = "django-bootstrap4-2.0.0.tar.gz", hash = "sha256:2618205322306b1cf3e4e67ec9d42cdf30b2656bf06d2b65d17498b0b2667271"}, {file = "django_bootstrap4-2.0.0-py3-none-any.whl", hash = "sha256:ca51246ea4a0bc06f7fa4305cefe7f7700cc09e7da1280f7bea5213470bb673d"}, ] -django-cachalot = [ - {file = "django-cachalot-2.2.0.tar.gz", hash = "sha256:c6fa5d0b8c0f8e812e4d9d512d0f923937413f6a892276fe0b094da57cd0d321"}, -] django-debug-toolbar = [ {file = "django-debug-toolbar-2.2.tar.gz", hash = "sha256:eabbefe89881bbe4ca7c980ff102e3c35c8e8ad6eb725041f538988f2f39a943"}, {file = "django_debug_toolbar-2.2-py3-none-any.whl", hash = "sha256:ff94725e7aae74b133d0599b9bf89bd4eb8f5d2c964106e61d11750228c8774c"}, @@ -572,6 +568,21 @@ importlib-metadata = [ {file = "importlib_metadata-1.6.0-py2.py3-none-any.whl", hash = "sha256:2a688cbaa90e0cc587f1df48bdc97a6eadccdcd9c35fb3f976a09e3b5016d90f"}, {file = "importlib_metadata-1.6.0.tar.gz", hash = "sha256:34513a8a0c4962bc66d35b359558fd8a5e10cd472d37aec5f66858addef32c1e"}, ] +libsass = [ + {file = "libsass-0.20.0-cp27-cp27m-macosx_10_14_intel.whl", hash = "sha256:107c409524c6a4ed14410fa9dafa9ee59c6bd3ecae75d73af749ab2b75685726"}, + {file = "libsass-0.20.0-cp27-cp27m-win32.whl", hash = "sha256:98f6dee9850b29e62977a963e3beb3cfeb98b128a267d59d2c3d675e298c8d57"}, + {file = "libsass-0.20.0-cp27-cp27m-win_amd64.whl", hash = "sha256:b077261a04ba1c213e932943208471972c5230222acb7fa97373e55a40872cbb"}, + {file = "libsass-0.20.0-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:e6a547c0aa731dcb4ed71f198e814bee0400ce04d553f3f12a53bc3a17f2a481"}, + {file = "libsass-0.20.0-cp36-abi3-manylinux1_x86_64.whl", hash = "sha256:74f6fb8da58179b5d86586bc045c16d93d55074bc7bb48b6354a4da7ac9f9dfd"}, + {file = "libsass-0.20.0-cp36-cp36m-win32.whl", hash = "sha256:a43f3830d83ad9a7f5013c05ce239ca71744d0780dad906587302ac5257bce60"}, + {file = "libsass-0.20.0-cp36-cp36m-win_amd64.whl", hash = "sha256:fd19c8f73f70ffc6cbcca8139da08ea9a71fc48e7dfc4bb236ad88ab2d6558f1"}, + {file = "libsass-0.20.0-cp37-abi3-macosx_10_14_x86_64.whl", hash = "sha256:8cf72552b39e78a1852132e16b706406bc76029fe3001583284ece8d8752a60a"}, + {file = "libsass-0.20.0-cp37-cp37m-win32.whl", hash = "sha256:7555d9b24e79943cfafac44dbb4ca7e62105c038de7c6b999838c9ff7b88645d"}, + {file = "libsass-0.20.0-cp37-cp37m-win_amd64.whl", hash = "sha256:794f4f4661667263e7feafe5cc866e3746c7c8a9192b2aa9afffdadcbc91c687"}, + {file = "libsass-0.20.0-cp38-cp38-win32.whl", hash = "sha256:3bc0d68778b30b5fa83199e18795314f64b26ca5871e026343e63934f616f7f7"}, + {file = "libsass-0.20.0-cp38-cp38-win_amd64.whl", hash = "sha256:5c8ff562b233734fbc72b23bb862cc6a6f70b1e9bf85a58422aa75108b94783b"}, + {file = "libsass-0.20.0.tar.gz", hash = "sha256:b7452f1df274b166dc22ee2e9154c4adca619bcbbdf8041a7aa05f372a1dacbc"}, +] markdown = [ {file = "Markdown-3.2.2-py3-none-any.whl", hash = "sha256:c467cd6233885534bf0fe96e62e3cf46cfc1605112356c4f9981512b8174de59"}, {file = "Markdown-3.2.2.tar.gz", hash = "sha256:1fafe3f1ecabfb514a5285fca634a53c1b32a81cb0feb154264d55bf2ff22c17"}, diff --git a/pyproject.toml b/pyproject.toml index 7441c5e..4cb5e65 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ Pillow = "^7.1.2" gunicorn = "^20.0.4" beautifulsoup4 = "^4.9.1" django-bootstrap4 = "^2.0.0" -django-cachalot = "^2.2.0" +libsass = "^0.20.0" [tool.poetry.dev-dependencies] bpython = "^0.19" diff --git a/static/ads.ico b/static/images/ads.ico similarity index 100% rename from static/ads.ico rename to static/images/ads.ico diff --git a/static/images/ads.png b/static/images/ads.png new file mode 100644 index 0000000000000000000000000000000000000000..29577130d0b79998b687a5efc9609d9c7290ac27 GIT binary patch literal 1511 zcmY*ZdpOf;9DkV^qv;?am1@y*YRt4QQ#ALf&CDgK2jzZ9E^`SnsV7ISvmBvLc|6s5 zTn?3Tnd{sqm!(P6(LoqGXf|e>^XuvSbN+b0-}imL-_Pg!dA{HGd4Hu+9JV3#kpO^g zBu85sMm8A|euRbU;KoVn`=RSBW4 zrnTS9IftAyc`j)Z>zu8oxgVyaa@c`ENuEAz&#(?{w+?Mn)7-aR-;@+L3NdKtVbrw_ zkYe8Uvy3)9#t8m^*2zVZ3A-wT+s znt_R%4%*s`nrmzobtaf?PP^w6|G~ni!kIA#NjiJ|12MSCjGAX;8M)ikT?b7h-}oEn zk`D=1)iC(k?#6+WL5fNUyhkzKy_n!ruC9HM;0;;yQTHNMls*)N1SrCkVaiAdYh)RL zqp_d_tAN)QKIP^#7DNk!BdMwLu4(fz#Y;I=E5)x@v#XY)?k~}9&f7=!U$`Uqvs3s@ zB-`5BS`o^syVkt#3Y_A{&IC31+!ag-HWyZ;emM(}DoAHHU);(QJEwesS`@@wkjv#W zi<{Y%%aQk&3TszaMKaO4jG8)Yd$o)8d?l2%Sjzq;lgVi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X5v061V992@{mQY^5L91W8V zlyn?9IRMzm4lY&>-mWV2B$^%aR5Xt74Fs*plC6UjsPwm4vASRtAiu? z@dpjBcRsZJR6l@gCtQ^>& zF%2RO4d@O3|NsB8n=Muj(~~&qr-iYIZj9258<`v9|Kq;hzLUn2v2INiq!j7Fr>Vu5 zDl!?kwRKHWDBbjiVHfau#t|Jg(R7LQXYF~|2Btd)i z1cFgXJ%Lf0WNHy&Y-JQU8>=D+MKUb4Rwk@b9M8wmsy1;lx-R?IHxkJd&(#=|e}NK^ z=EN>GwS$5pa&l6@7B5zm(2jb0Cz(?JtKImXc7yj14wI@b=}h`a*>ltJ_DKMNPZMXn z7=_`_Hxt<`0$-E~=3MR)8JP(}S6q^&>FW%41=+xx+dE@EFYot#;o-3;&qG;S`%~`Z z`2`Sl;I+^gc&lFfchBX==Zl<1U{5=AhXXvjVXUMVzp~$Y!p|=jEPuGr8Yi6}{nzFH z0YYPUTUYwn=KufzC3HntbYx+4WjbSWWnpw>05UK#FfA}PEif`vF*!OjGdeOeD=;!T zFfgZUt91YX03~!qSaf7zbY(hiZ)9m^c>ppnGB7PLG%YeSR53X^G%z|dGAl4LIxsMB S2eHHe0000{% block title %}Acronomy{% endblock %} - - - - + {% block extra_head %} {% endblock %} @@ -33,11 +30,11 @@ {% block content %} {% endblock %} - - - - - + + + + +