Compare commits

...

12 Commits

Author SHA1 Message Date
d1069a1745 That was silly 2021-02-23 01:27:42 +00:00
238d53a547 Try reimplementing caching on CI 2021-02-23 01:25:32 +00:00
8756e7f880 Oops 2021-02-23 01:19:38 +00:00
25c9cf25f7 Disable asset cache on ci, try to get assets working on heroku
Whyyy do things just randomly fall over
2021-02-23 01:11:33 +00:00
ad66f434de bah staticfiles 2021-02-23 01:01:36 +00:00
1aae2bff28 Damn you pipeline 2021-02-23 00:40:27 +00:00
9302cccd58 Swithc to pathlib in settings 2021-02-23 00:34:27 +00:00
123c8bfd80 Serve logo in next gen format 2021-02-22 23:53:53 +00:00
02af3870aa Can't async jquery 2021-02-22 23:48:23 +00:00
6d3a861df5 Preload fontawesome 2021-02-22 23:46:20 +00:00
0e07c50c18 Prevent search engines indexing us
Might help cut down the spam
2021-02-22 23:41:58 +00:00
8505d5e93a Squash jquery and popper together 2021-02-22 23:41:42 +00:00
9 changed files with 33 additions and 35 deletions

View File

@@ -14,21 +14,12 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- name: Cache Static Files
id: static-cache
uses: actions/cache@v2
with:
path: 'static/'
key: ${{ hashFiles('package-lock.json') }}-${{ hashFiles('pipeline/source_assets') }}
- uses: bahmutov/npm-install@v1
if: steps.static-cache.outputs.cache-hit != 'true'
- run: node node_modules/gulp/bin/gulp build
if: steps.static-cache.outputs.cache-hit != 'true'
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Cache python deps
id: pcache
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
@@ -43,7 +34,18 @@ jobs:
pipenv run pycodestyle . --exclude=migrations,node_modules
pipenv run python manage.py check
pipenv run python manage.py makemigrations --check --dry-run
pipenv run python manage.py collectstatic --noinput
- name: Cache Static Files
id: static-cache
uses: actions/cache@v2
with:
path: 'static/'
key: ${{ hashFiles('package-lock.json') }}-${{ hashFiles('pipeline/source_assets') }}
- uses: bahmutov/npm-install@v1
if: steps.static-cache.outputs.cache-hit != 'true'
- run: node node_modules/gulp/bin/gulp build
if: steps.static-cache.outputs.cache-hit != 'true'
- run: pipenv run python manage.py collectstatic --noinput
if: steps.static-cache.outputs.cache-hit != 'true'
- name: Run Tests
run: pipenv run pytest -n auto -vv --cov
- uses: actions/upload-artifact@v2

View File

@@ -9,23 +9,18 @@ https://docs.djangoproject.com/en/1.7/ref/settings/
"""
import datetime
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
from pathlib import Path
import secrets
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
from envparse import env
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve(strict=True).parent.parent
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env('SECRET_KEY', default='gxhy(a#5mhp289_=6xx$7jh=eh$ymxg^ymc+di*0c*geiu3p_e')
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env('DEBUG', cast=bool, default=True)
STAGING = env('STAGING', cast=bool, default=False)
@@ -97,7 +92,7 @@ WSGI_APPLICATION = 'PyRIGS.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
'NAME': str(BASE_DIR / 'db.sqlite3'),
}
}
@@ -235,19 +230,16 @@ DATETIME_INPUT_FORMATS = ('%Y-%m-%dT%H:%M', '%Y-%m-%dT%H:%M:%S')
# Static files (CSS, JavaScript, Images)
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
STATIC_DIRS = [
os.path.join(BASE_DIR, 'static/'),
]
STATIC_ROOT = str(BASE_DIR / 'static/')
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'pipeline/built_assets'),
str(BASE_DIR / 'pipeline/built_assets'),
]
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'templates')
BASE_DIR / 'templates'
],
'APP_DIRS': True,
'OPTIONS': {

View File

@@ -27,13 +27,14 @@ urlpatterns = [
path('', include('users.urls')),
path('admin/', admin.site.urls),
path("robots.txt", TemplateView.as_view(template_name="robots.txt", content_type="text/plain")),
]
if settings.DEBUG:
urlpatterns += staticfiles_urlpatterns()
import debug_toolbar
urlpatterns = [
urlpatterns += [
path('__debug__/', include(debug_toolbar.urls)),
path('bootstrap/', TemplateView.as_view(template_name="bootstrap.html")),
] + urlpatterns
]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 28 KiB

BIN
RIGS/static/imgs/logo.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -44,9 +44,10 @@ function scripts() {
const base_scripts = ["src.js", "util.js", "alert.js", "collapse.js", "dropdown.js", "modal.js", "konami.js"];
const bs_select = ["bootstrap-select.js", "ajax-bootstrap-select.js"]
const interaction = ["html5sortable.min.js", "interaction.js"]
return gulp.src(['node_modules/jquery/dist/jquery.js',
const jpop = ["jquery.min.js", "popper.min.js"]
return gulp.src(['node_modules/jquery/dist/jquery.min.js',
/* JQuery Plugins */
'node_modules/popper.js/dist/umd/popper.js',
'node_modules/popper.js/dist/umd/popper.min.js',
/* Bootstrap Plugins */
'node_modules/bootstrap/js/dist/util.js',
'node_modules/bootstrap/js/dist/tooltip.js',
@@ -68,6 +69,7 @@ function scripts() {
.pipe(gulpif(function(file) { return base_scripts.includes(file.relative);}, con('base.js')))
.pipe(gulpif(function(file) { return bs_select.includes(file.relative);}, con('selects.js')))
.pipe(gulpif(function(file) { return interaction.includes(file.relative);}, con('interaction.js')))
.pipe(gulpif(function(file) { return jpop.includes(file.relative);}, con('jpop.js')))
.pipe(flatten())
.pipe(terser())
.pipe(gulp.dest(dest))

View File

@@ -15,14 +15,13 @@
<link rel="icon" type="image/png" href="{% static 'imgs/pyrigs-avatar.png' %}">
<link rel="apple-touch-icon" href="{% static 'imgs/pyrigs-avatar.png' %}">
<link href="{% static 'fonts/OpenSans-Regular.tff' %}">
<link rel="preload" href="{% static 'fonts/fa-solid-900.woff2' %}" as="font" type="font/woff2" crossorigin>
<link rel="stylesheet" type="text/css" href="{% static 'css/screen.css' %}">
{% block css %}
{% endblock %}
<script src="{% static 'js/jquery.js' %}"></script>
<script src="{% static 'js/popper.js' %}"></script>
<script src="{% static 'js/jpop.js' %}"></script>
{% block preload_js %}
{% endblock %}
@@ -35,7 +34,7 @@
{% block navbar %}
<nav class="navbar navbar-expand-lg navbar-dark bg-dark flex-nowrap" role="navigation">
<a class="navbar-brand" href="{% if request.user.is_authenticated %}https://members.nottinghamtec.co.uk{%else%}https://nottinghamtec.co.uk{%endif%}">
<img src="{% static 'imgs/logo.png' %}" width="40" height="40" alt="TEC's Logo: Serif 'TEC' vertically next to a blue box with the words 'PA and Lighting', surrounded by graduated rings">
<img src="{% static 'imgs/logo.webp' %}" width="40" height="40" alt="TEC's Logo: Serif 'TEC' vertically next to a blue box with the words 'PA and Lighting', surrounded by graduated rings">
</a>
<div class="container">
{% block titleheader %}

View File

@@ -33,7 +33,7 @@
<a class="list-group-item list-group-item-action" href="https://forum.nottinghamtec.co.uk" target="_blank" rel="noopener noreferrer"><span class="fas fa-comment-alt text-info align-middle"></span><span class="align-middle"> TEC Forum</span></a>
<a class="list-group-item list-group-item-action" href="//wiki.nottinghamtec.co.uk" target="_blank" rel="noopener noreferrer"><span class="fas fa-pen-square align-middle"></span><span class="align-middle"> TEC Wiki</span></a>
{% if perms.RIGS.view_event %}
<a class="list-group-item list-group-item-action" href="//members.nottinghamtec.co.uk/price" target="_blank"><span class="fas fa-pound-sign text-warning align-middle"></span><span class="align-middle"> Price List</span></a>
<a class="list-group-item list-group-item-action" href="//members.nottinghamtec.co.uk/price" target="_blank" rel="noopener noreferrer"><span class="fas fa-pound-sign text-warning align-middle"></span><span class="align-middle"> Price List</span></a>
{% endif %}
</div>
</div>

2
templates/robots.txt Normal file
View File

@@ -0,0 +1,2 @@
User-agent: *
Disallow: /