The event system allows you to emit events to the backend and listen to events from it. Система событий позволяет вам отправлять события в серверную часть и прослушивать события из нее.
from woocommerce import API
import json
wcapi = API(
url=u"https://streetclimate.ru",
consumer_key="ck_",
consumer_secret="cs_",
wp_api=True,
version="wc/v2",
query_string_auth=True # Force Basic Authentication as query string true and using under HTTPS
)
def read_test(id):
r = wcapi.get(f"products/{id}").json()
print(r, '\n')
r: list[object] = wcapi.get("products", params={'per_page': 1, 'status': 'publish'}).json()
environment:
- CHOKIDAR_USEPOLLING=true
.gitignore
.git
.idea
node_modules
FROM node:lts-alpine as build
ARG APP_DIR=app
WORKDIR /${APP_DIR}
ENV PATH /app/node_modules/.bin:$PATH
COPY package.json ./
RUN npm install npm@latest
RUN npm install --no-progress --ignore-optional
RUN npm install @vue/cli -g
EXPOSE 5000
CMD ["npm", "run", "serve"]
version: '3.9'
#настройка сети между контейнерами.
networks:
static-network:
ipam:
driver: default
config:
- subnet: 10.5.0.0/16
services:
database:
image: postgres:13 # имя контейнера
container_name: "postgres_cont"
ports:
- "6532:5432"
env_file:
- pg-env.env # configure env postgres
volumes:
- E:\docker\volumes\postgres:/var/lib/postgresql/data
restart: unless-stopped #рестарт если контейнер "вылетает"
logging: #отключаем логирование в консоли
driver: none
networks:
static-network:
ipv4_address: 10.5.0.5
pgAdmin:
image: dpage/pgadmin4 #имя контейнера
container_name: "pgAdmin_cont"
ports:
- "5555:80"
env_file:
- pgadmin-env.env # configure pgAdmin
depends_on:
- database
volumes:
- E:\docker\volumes\pgAdmin:/var/lib/pgadmin
restart: unless-stopped #рестарт если контейнер "вылетает"
logging: #отключаем логирование в консоли
driver: none
networks:
static-network:
ipv4_address: 10.5.0.8
app_fastapi:
# image: python:3.8
container_name: "app_FastAPI" #имя контейнера
build:
context: ./FastAPI
dockerfile: Dockerfile
volumes:
- ./FastAPI:/app_fastapi
ports:
- 8000:8000
depends_on:
- database
entrypoint: ["python", "main.py"]
restart: unless-stopped #рестарт если контейнер "вылетает"
networks: #принудительно задаём IP
static-network:
ipv4_address: 10.5.0.6
vue_frontend:
container_name: vue_ui
build:
context: ./pprint_vue
dockerfile: Dockerfile
stdin_open: true
tty: true
environment:
- CHOKIDAR_USEPOLLING=true
volumes:
- ./pprint_vue:/app
- /app/node_modules
ports:
- "5000:5000"
restart: unless-stopped #рестарт если контейнер "вылетает"
depends_on:
- app_fastapi
networks: #принудительно задаём IP
static-network:
ipv4_address: 10.5.0.10
volumes:
pprint_vue:
name: pprint_vue
FastAPI:
name: FastAPI
"scripts": {
"serve": "vue-cli-service serve --port 5000",
"build": "vue-cli-service build"
},
<script>
import {mapGetters, mapActions} from 'vuex'
export default {
name: 'login',
data() {
return {
form: {
email: null,
password: null,
}
}
},
// computed: mapGetters(['user/USER_AUTH']),
methods: {
...mapActions({
loginUser: 'user/LOGIN_USER'
}),
submit() {
this.loginUser(this.form)
.then(() => this.$router.push('/'))
.catch(err => console.log(err))
}
}
}
</script>
actions: {
async LOGIN_USER({ commit }, form) {
const response = await axios.post('api/v1/login', form)
const user = await response.data
commit('UPDATE_USER_AUTH', user)
},
mutations: {
UPDATE_USER_AUTH(state, user) {
localStorage.token = user.token
localStorage.email = user.email
localStorage.name = user.name
localStorage.role = user.role
state.token = user.token
state.email = user.email
state.name = user.name
state.role = user.role
}