Serve front end

This commit is contained in:
Daoud Clarke 2023-10-12 17:38:19 +01:00
parent 536487b3d2
commit 013c007bb0
8 changed files with 41 additions and 28 deletions

View file

@ -598,10 +598,16 @@
} }
}, },
"node_modules/nanoid": { "node_modules/nanoid": {
"version": "3.3.4", "version": "3.3.6",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz",
"integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==",
"dev": true, "dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"bin": { "bin": {
"nanoid": "bin/nanoid.cjs" "nanoid": "bin/nanoid.cjs"
}, },
@ -622,9 +628,9 @@
"dev": true "dev": true
}, },
"node_modules/postcss": { "node_modules/postcss": {
"version": "8.4.19", "version": "8.4.31",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.19.tgz", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz",
"integrity": "sha512-h+pbPsyhlYj6N2ozBmHhHrs9DzGmbaarbLvWipMRO7RLS+v4onj26MPFXA5OBYFxyqYhUJK456SwDcY9H2/zsA==", "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@ -634,10 +640,14 @@
{ {
"type": "tidelift", "type": "tidelift",
"url": "https://tidelift.com/funding/github/npm/postcss" "url": "https://tidelift.com/funding/github/npm/postcss"
},
{
"type": "github",
"url": "https://github.com/sponsors/ai"
} }
], ],
"dependencies": { "dependencies": {
"nanoid": "^3.3.4", "nanoid": "^3.3.6",
"picocolors": "^1.0.0", "picocolors": "^1.0.0",
"source-map-js": "^1.0.2" "source-map-js": "^1.0.2"
}, },
@ -755,9 +765,9 @@
} }
}, },
"node_modules/vite": { "node_modules/vite": {
"version": "3.2.5", "version": "3.2.7",
"resolved": "https://registry.npmjs.org/vite/-/vite-3.2.5.tgz", "resolved": "https://registry.npmjs.org/vite/-/vite-3.2.7.tgz",
"integrity": "sha512-4mVEpXpSOgrssFZAOmGIr85wPHKvaDAcXqxVxVRZhljkJOMZi1ibLibzjLHzJvcok8BMguLc7g1W6W/GqZbLdQ==", "integrity": "sha512-29pdXjk49xAP0QBr0xXqu2s5jiQIXNvE/xwd0vUizYT2Hzqe4BksNNoWllFVXJf4eLZ+UlVQmXfB4lWrc+t18g==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"esbuild": "^0.15.9", "esbuild": "^0.15.9",
@ -1135,9 +1145,9 @@
} }
}, },
"nanoid": { "nanoid": {
"version": "3.3.4", "version": "3.3.6",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz",
"integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==",
"dev": true "dev": true
}, },
"path-parse": { "path-parse": {
@ -1153,12 +1163,12 @@
"dev": true "dev": true
}, },
"postcss": { "postcss": {
"version": "8.4.19", "version": "8.4.31",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.19.tgz", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz",
"integrity": "sha512-h+pbPsyhlYj6N2ozBmHhHrs9DzGmbaarbLvWipMRO7RLS+v4onj26MPFXA5OBYFxyqYhUJK456SwDcY9H2/zsA==", "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"nanoid": "^3.3.4", "nanoid": "^3.3.6",
"picocolors": "^1.0.0", "picocolors": "^1.0.0",
"source-map-js": "^1.0.2" "source-map-js": "^1.0.2"
} }
@ -1242,9 +1252,9 @@
} }
}, },
"vite": { "vite": {
"version": "3.2.5", "version": "3.2.7",
"resolved": "https://registry.npmjs.org/vite/-/vite-3.2.5.tgz", "resolved": "https://registry.npmjs.org/vite/-/vite-3.2.7.tgz",
"integrity": "sha512-4mVEpXpSOgrssFZAOmGIr85wPHKvaDAcXqxVxVRZhljkJOMZi1ibLibzjLHzJvcok8BMguLc7g1W6W/GqZbLdQ==", "integrity": "sha512-29pdXjk49xAP0QBr0xXqu2s5jiQIXNvE/xwd0vUizYT2Hzqe4BksNNoWllFVXJf4eLZ+UlVQmXfB4lWrc+t18g==",
"dev": true, "dev": true,
"requires": { "requires": {
"esbuild": "^0.15.9", "esbuild": "^0.15.9",

View file

@ -3,7 +3,7 @@ import define from '../utils/define.js';
const template = () => /*html*/` const template = () => /*html*/`
<header class="search-menu"> <header class="search-menu">
<div class="branding"> <div class="branding">
<img class="brand-icon" src="/images/logo.svg" width="40" height="40" alt="mwmbl logo"> <img class="brand-icon" src="/static/images/logo.svg" width="40" height="40" alt="mwmbl logo">
<span class="brand-title">MWMBL</span> <span class="brand-title">MWMBL</span>
</div> </div>
<mwmbl-search-bar></mwmbl-search-bar> <mwmbl-search-bar></mwmbl-search-bar>

View file

@ -42,7 +42,7 @@
<mwmbl-app></mwmbl-app> <mwmbl-app></mwmbl-app>
<noscript> <noscript>
<main class="noscript"> <main class="noscript">
<img class="brand-icon" src="/images/logo.svg" width="40" height="40" alt="mwmbl logo"> <img class="brand-icon" src="/static/images/logo.svg" width="40" height="40" alt="mwmbl logo">
<h1> <h1>
Welcome to mwmbl, the free, open-source and non-profit search engine. Welcome to mwmbl, the free, open-source and non-profit search engine.
</h1> </h1>

View file

@ -3,6 +3,7 @@ import { resolve } from 'path'
export default { export default {
root: './src', root: './src',
base: '/static',
publicDir: '../assets', publicDir: '../assets',
build: { build: {
outDir: '../dist', outDir: '../dist',

View file

@ -6,7 +6,7 @@ import sys
def main(): def main():
"""Run administrative tasks.""" """Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings') os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mwmbl.settings_dev')
try: try:
from django.core.management import execute_from_command_line from django.core.management import execute_from_command_line
except ImportError as exc: except ImportError as exc:

View file

@ -22,9 +22,6 @@ BASE_DIR = Path(__file__).resolve().parent.parent
# SECURITY WARNING: keep the secret key used in production secret! # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-qqr#f(i3uf%m8%8u35vn=ov-uk(*8!a&1t-hxa%ev2^t1%j&sm' SECRET_KEY = 'django-insecure-qqr#f(i3uf%m8%8u35vn=ov-uk(*8!a&1t-hxa%ev2^t1%j&sm'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = ["api.mwmbl.org"] ALLOWED_HOSTS = ["api.mwmbl.org"]
@ -117,8 +114,8 @@ USE_TZ = True
# https://docs.djangoproject.com/en/4.2/howto/static-files/ # https://docs.djangoproject.com/en/4.2/howto/static-files/
STATIC_URL = 'static/' STATIC_URL = 'static/'
STATICFILES_DIRS = [Path(__file__).parent.parent / "front-end" / "dist"] STATICFILES_DIRS = [str(Path(__file__).parent.parent / "front-end" / "dist")]
print("Static files", STATICFILES_DIRS)
# Default primary key field type # Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field # https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field

View file

@ -1,5 +1,8 @@
from mwmbl.settings_common import * from mwmbl.settings_common import *
DEBUG = True
DATA_PATH = "./devdata" DATA_PATH = "./devdata"
RUN_BACKGROUND_PROCESSES = False RUN_BACKGROUND_PROCESSES = False
NUM_PAGES = 2560 NUM_PAGES = 2560

View file

@ -1,5 +1,7 @@
from mwmbl.settings_common import * from mwmbl.settings_common import *
DEBUG = False
DATA_PATH = "/app/storage" DATA_PATH = "/app/storage"
RUN_BACKGROUND_PROCESSES = True RUN_BACKGROUND_PROCESSES = True
NUM_PAGES = 10240000 NUM_PAGES = 10240000