chore [P-01]: vite hmr

This commit is contained in:
Nukeap committed 2025-02-26 08:04:18 +03:00
1 parent b10199a46e
commit c718a76490
6 files changed
+169 -221

No files matched your search

+10
View File
@@ -34,12 +34,22 @@ DB_HOST=""
DB_EXTERNAL_PORT=3306 DB_EXTERNAL_PORT=3306
DB_INTERNAL_PORT=3306 DB_INTERNAL_PORT=3306
REDIS="redis://redis"
REDISBROKER="redis://redis"
REDIS_PORT=6379
REDIS_BASE=0
FRONTEND_EXTERNAL_PORT=3000 FRONTEND_EXTERNAL_PORT=3000
FRONTEND_INTERNAL_PORT=3000 FRONTEND_INTERNAL_PORT=3000
BACKEND_EXTERNAL_PORT=8000 BACKEND_EXTERNAL_PORT=8000
BACKEND_INTERNAL_PORT=8000 BACKEND_INTERNAL_PORT=8000
DOCS_EXTERNAL_PORT=5173 DOCS_EXTERNAL_PORT=5173
DOCS_INTERNAL_PORT=5173 DOCS_INTERNAL_PORT=5173
NGINX_EXTERNAL_PORT=80 NGINX_EXTERNAL_PORT=80
+3 -2
View File
@@ -23,7 +23,8 @@ services:
ports: ports:
- "${FRONTEND_EXTERNAL_PORT}:${FRONTEND_INTERNAL_PORT}" - "${FRONTEND_EXTERNAL_PORT}:${FRONTEND_INTERNAL_PORT}"
environment:
- CHOKIDAR_USEPOLLING=true
networks: networks:
@@ -33,7 +34,7 @@ services:
redis: redis:
image: redis:alpine # Используем легковесный образ Redis image: redis:alpine # Используем легковесный образ Redis
ports: ports:
- "6379:6379" # Открываем порт Redis для внешнего доступа (по желанию) - "${REDIS_PORT}:${REDIS_PORT}" # Открываем порт Redis для внешнего доступа (по желанию)
networks: networks:
- dev - dev
+37 -22
View File
@@ -2,26 +2,41 @@ from datetime import timedelta
import os import os
class Settings():
def __init__(self) -> None:
self.secret_key='V7bvDZMztr3EU8S9g1Dipw'
self.redis_hosts = [("redis", 6379)]
self.access_token_lifetime = timedelta(minutes=480)
self.refresh_token_lifetime = timedelta(days=1)
self.db = {
'default':{
'ENGINE': 'django.db.backends.mysql',
'NAME': os.getenv('DB_NAME'), # Имя базы данных
'USER': os.getenv('DB_USER'), # Имя пользователя
'PASSWORD': os.getenv('DB_PASSWORD'), # Пароль class Settings:
'HOST': os.getenv('DB_HOST'), # Хост """
'PORT': os.getenv('DB_INTERNAL_PORT'), # Порт Настройки подключений - потом перенести
} """
}
def __init__(self) -> None:
"""
pass Настройки подключений - потом перенести
"""
self.secret_key = "V7bvDZMztr3EU8S9g1Dipw"
self.redis_hosts = [f"{str(os.getenv('REDIS'))}:{str(os.getenv('REDIS_PORT'))}"]
self.access_token_lifetime = timedelta(minutes=480)
self.refresh_token_lifetime = timedelta(days=1)
self.db = {
"default": {
"ENGINE": "django.db.backends.mysql",
"NAME": os.getenv("DB_NAME"), # Имя базы данных
"USER": os.getenv("DB_USER"), # Имя пользователя
"PASSWORD": os.getenv("DB_PASSWORD"), # Пароль
"HOST": os.getenv("DB_HOST"), # Хост
"PORT": os.getenv("DB_INTERNAL_PORT"), # Порт
}
}
def foo1(self) -> None:
"""
Настройки - потом перенести
"""
return None
def foo2(self) -> None:
"""
Настройки подключений - потом перенести
"""
return None
+104 -173
View File
@@ -1,192 +1,127 @@
<template> <template>
<v-container fluid class="d-flex mx-0 pa-0"> <v-container fluid class="d-flex mx-0 pa-0">
<v-row class="ma-2"> <v-row class="ma-2">
<v-col <v-col class="d-flex flex-column" lg="7" md="12" cols="12">
class="d-flex flex-column" <v-row class="flex-grow-0">
lg=7 <v-col class="pa-1">
md=12 <Carousel-list />
cols=12 </v-col>
> </v-row>
<v-row class="flex-grow-0"> <v-row style="height: 250px">
<v-col class="pa-1"> <v-col class="d-flex flex-column flex-grow-0 pa-1">
<Carousel-list/> <!-- <event-calendar/> -->
</v-col>
</v-row>
</v-col> </v-col>
</v-row> <v-col class="d-flex flex-column" lg="5" md="12" cols="12">
<v-row style="height:250px"> <v-row>
<v-col class="d-flex flex-column flex-grow-0 pa-1"> <v-col class="d-flex flex-column">
<!-- <event-calendar/> --> <v-row>
<v-col lg="4" md="2" cols="12" class="pa-1" style="min-height: 250px">
</v-col> <digital-letna />
</v-row> </v-col>
</v-col> <v-col
<v-col class="d-flex flex-column pa-1"
class="d-flex flex-column" lg="8"
lg=5 md="10"
md=12 cols="12"
cols=12 style="min-height: 550px"
>
<v-row>
<v-col class="d-flex flex-column">
<v-row >
<v-col
lg=4
md=2
cols=12
class="pa-1"
style="min-height:250px"
>
<digital-letna/>
</v-col>
<v-col
class="d-flex flex-column pa-1"
lg=8
md=10
cols=12
style="min-height:550px"
>
<v-card class="h-100 d-flex flex-column">
<v-row class="d-flex justify-md-center">
<v-col class="flex-column d-flex">
<news-home/>
</v-col>
</v-row>
</v-card>
</v-col>
</v-row>
</v-col>
</v-row>
<v-row class="flex-grow-0">
<v-col class="pa-1">
<v-card class="flex-colmn">
<v-sheet
class="mx-auto "
:class="favorit.length>10?'mx-n3':''"
max-width="800"
>
<v-slide-group
show-arrows
> >
<v-card class="h-100 d-flex flex-column">
<v-row class="d-flex justify-md-center">
<v-slide-group-item <v-col class="flex-column d-flex">
v-for="x in favorit" <news-home />
:key="x" </v-col>
> </v-row>
<v-btn-toggle </v-card>
v-model="toggle" </v-col>
divided </v-row>
variant="outlined" </v-col>
> </v-row>
<v-tooltip <v-row class="flex-grow-0">
<v-col class="pa-1">
<v-card class="flex-colmn">
:text="x.pages__page" <v-sheet class="mx-auto" :class="favorit.length > 10 ? 'mx-n3' : ''" max-width="800">
location="top" <v-slide-group show-arrows>
> <v-slide-group-item v-for="x in favorit" :key="x">
<template v-slot:activator="{ props }"> <v-btn-toggle v-model="toggle" divided variant="outlined">
<v-btn <v-tooltip :text="x.pages__page" location="top">
v-bind="props" <template v-slot:activator="{ props }">
:icon="x.pages__ico" <v-btn v-bind="props" :icon="x.pages__ico" :to="x.pages__fullPath" />
:to="x.pages__fullPath" </template>
/> </v-tooltip>
</template> </v-btn-toggle>
</v-tooltip> </v-slide-group-item>
</v-btn-toggle> </v-slide-group>
</v-slide-group-item> </v-sheet>
</v-slide-group> </v-card>
</v-sheet> </v-col>
</v-row>
</v-card> </v-col>
</v-col> </v-row>
</v-container>
</v-row>
</v-col>
</v-row>
</v-container>
</template> </template>
<script> <script>
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue';
import {useAppStore} from '@/store/app' import { useAppStore } from '@/store/app';
import {useAccountStore} from '@/store/AccountStore' import { useAccountStore } from '@/store/AccountStore';
import {pagecounter} from '@/utils/universal_functions' import { pagecounter } from '@/utils/universal_functions';
import CarouselList from '@/components/carousel-list.vue' import CarouselList from '@/components/carousel-list.vue';
import CarouselNumbers from '@/components/carousel-numbers.vue'
import NewsHome from '@/components/news-home.vue' import NewsHome from '@/components/news-home.vue';
import LoadRound from '@/components/load-round.vue'
import DigitalLetna from '@/components/digital-letna.vue'
import { axiosApiInstance } from '@/utils/axios-api'
import EventCalendar from '@/components/calendar_of_events/event-calendar.vue' import DigitalLetna from '@/components/digital-letna.vue';
import { axiosApiInstance } from '@/utils/axios-api';
export default { export default {
components: {
CarouselList,
components: { DigitalLetna,
CarouselList,
CarouselNumbers,
NewsHome,
},
LoadRound, setup() {
DigitalLetna, const appStore = useAppStore();
EventCalendar, const favorit = ref([]);
NewsHome const toggle = ref(null);
},
const accountStore = useAccountStore();
pagecounter();
setup(){ onMounted(() => {
const appStore = useAppStore() favoritLinks();
const favorit = ref([]) });
const toggle = ref(null)
const burl ="d"
const accountStore = useAccountStore()
pagecounter()
onMounted(() => { const favoritLinks = () => {
favoritLinks() axiosApiInstance.get(`api/watcher/selectedlinks/`).then((data) => {
favorit.value = data.data;
});
};
}) return {
accountStore,
appStore,
favoritLinks,
favorit,
const favoritLinks = () => { toggle,
};
},
axiosApiInstance.get(`api/watcher/selectedlinks/`) };
.then(data => {
favorit.value = data.data
})
}
return {
accountStore,
appStore,
favoritLinks,
favorit,
toggle
}
}
}
</script> </script>
<style lang="scss"> <style lang="scss">
.v-picker-title,
.v-picker-title, .v-picker__header, .v-picker__actions { .v-picker__header,
.v-picker__actions {
display: none; display: none;
} }
.pik { .pik {
height: 84vh; height: 84vh;
/*height: 85.3vh;*/ /*height: 85.3vh;*/
@@ -194,7 +129,7 @@
} }
.hicard { .hicard {
height: 40%!important; height: 40% !important;
overflow: auto; overflow: auto;
} }
@@ -203,8 +138,6 @@
overflow: auto; overflow: auto;
} }
.fixed-bar { .fixed-bar {
position: sticky; position: sticky;
position: -webkit-sticky; /* for Safari */ position: -webkit-sticky; /* for Safari */
@@ -213,14 +146,12 @@
} }
.bgCard { .bgCard {
/* #ffffff6b #ffffff8c*/ /* #ffffff6b #ffffff8c*/
background: #ffffff38 ; background: #ffffff38;
} }
.bgText { .bgText {
background: #ffffffb0; background: #ffffffb0;
line-height: 2.1rem!important; line-height: 2.1rem !important;
} }
</style> </style>
+12 -23
View File
@@ -1,46 +1,35 @@
// Plugins // Plugins
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue';
import vuetify, { transformAssetUrls } from 'vite-plugin-vuetify' import vuetify, { transformAssetUrls } from 'vite-plugin-vuetify';
// Utilities // Utilities
import { defineConfig } from 'vite' import { defineConfig } from 'vite';
import { fileURLToPath, URL } from 'node:url' import { fileURLToPath, URL } from 'node:url';
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [
vue({
vue({ template: { transformAssetUrls },
template: { transformAssetUrls }
}), }),
// https://github.com/vuetifyjs/vuetify-loader/tree/next/packages/vite-plugin // https://github.com/vuetifyjs/vuetify-loader/tree/next/packages/vite-plugin
vuetify({ vuetify({
autoImport: true, autoImport: true,
}), }),
], ],
define: { 'process.env': {} }, define: { 'process.env': {} },
resolve: { resolve: {
alias: { alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)) '@': fileURLToPath(new URL('./src', import.meta.url)),
}, },
extensions: [ extensions: ['.js', '.json', '.jsx', '.mjs', '.ts', '.tsx', '.vue'],
'.js',
'.json',
'.jsx',
'.mjs',
'.ts',
'.tsx',
'.vue',
],
}, },
server: { server: {
host: '0.0.0.0', host: '0.0.0.0',
port: 3000, port: 3000,
hmr:{ hmr: {
host: '0.0.0.0', // host: '0.0.0.0',
port: 3000, port: 3000,
} },
}, },
}) });
+3 -1
View File
@@ -49,7 +49,9 @@ http {
} }
location / { location / {
proxy_pass http://frontend:${FRONTEND_EXTERNAL_PORT}; # Прокси на фронтенд proxy_pass http://frontend:${FRONTEND_EXTERNAL_PORT}; # Прокси на фронтенд
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;