提交 23def752 编写于 作者: 6 62f3568c7066201db17ad50a

添加web服务Demo

上级 bc9165f1
......@@ -135,3 +135,66 @@
2022-11-17 13:37:58,874 - werkzeug - INFO - 127.0.0.1 - - [17/Nov/2022 13:37:58] "GET /api/video/1 HTTP/1.1" 200 -
2022-11-17 13:57:53,088 - werkzeug - INFO - 127.0.0.1 - - [17/Nov/2022 13:57:53] "GET / HTTP/1.1" 200 -
2022-11-17 13:58:16,747 - werkzeug - INFO - 127.0.0.1 - - [17/Nov/2022 13:58:16] "GET / HTTP/1.1" 200 -
2022-11-18 04:24:15,009 - werkzeug - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:5000
* Running on http://192.168.0.141:5000
2022-11-18 04:24:15,009 - werkzeug - INFO - Press CTRL+C to quit
2022-11-18 04:24:15,010 - werkzeug - INFO - * Restarting with stat
2022-11-18 04:24:15,175 - werkzeug - WARNING - * Debugger is active!
2022-11-18 04:24:15,175 - werkzeug - INFO - * Debugger PIN: 222-929-307
2022-11-18 04:24:18,071 - werkzeug - INFO - 127.0.0.1 - - [18/Nov/2022 04:24:18] "GET / HTTP/1.1" 200 -
2022-11-18 04:24:22,577 - werkzeug - INFO - 127.0.0.1 - - [18/Nov/2022 04:24:22] "GET / HTTP/1.1" 200 -
2022-11-18 04:24:22,931 - werkzeug - INFO - 127.0.0.1 - - [18/Nov/2022 04:24:22] "GET /favicon.ico HTTP/1.1" 404 -
2022-11-18 04:24:56,612 - werkzeug - INFO - 127.0.0.1 - - [18/Nov/2022 04:24:56] "GET /_static/src/browser/pages/error.css HTTP/1.1" 404 -
2022-11-18 04:24:56,613 - werkzeug - INFO - 127.0.0.1 - - [18/Nov/2022 04:24:56] "GET /_static/src/browser/pages/global.css HTTP/1.1" 404 -
2022-11-18 04:24:56,705 - werkzeug - INFO - 127.0.0.1 - - [18/Nov/2022 04:24:56] "GET /manifest.json HTTP/1.1" 404 -
2022-11-18 04:24:56,728 - werkzeug - INFO - 127.0.0.1 - - [18/Nov/2022 04:24:56] "GET /_static/src/browser/media/favicon.ico HTTP/1.1" 404 -
2022-11-18 04:24:56,778 - werkzeug - INFO - 127.0.0.1 - - [18/Nov/2022 04:24:56] "GET /_static/src/browser/media/favicon-dark-support.svg HTTP/1.1" 404 -
2022-11-18 04:25:28,340 - werkzeug - INFO - 127.0.0.1 - - [18/Nov/2022 04:25:28] "GET /_static/src/browser/pages/global.css HTTP/1.1" 404 -
2022-11-18 04:25:28,344 - werkzeug - INFO - 127.0.0.1 - - [18/Nov/2022 04:25:28] "GET /_static/src/browser/pages/error.css HTTP/1.1" 404 -
2022-11-18 04:25:28,432 - werkzeug - INFO - 127.0.0.1 - - [18/Nov/2022 04:25:28] "GET /manifest.json HTTP/1.1" 404 -
2022-11-18 04:26:18,967 - root - DEBUG - Get token from token_url='http://kelezj.com/v/api/gettoken'
2022-11-18 04:26:18,970 - urllib3.connectionpool - DEBUG - Starting new HTTP connection (1): kelezj.com:80
2022-11-18 04:26:21,139 - urllib3.connectionpool - DEBUG - http://kelezj.com:80 "GET /v/api/gettoken HTTP/1.1" 200 42
2022-11-18 04:26:21,140 - root - DEBUG - Get token success: token={'token': 'qp8j3mqkvh', 'user': ['211229kl']}
2022-11-18 04:26:21,141 - root - DEBUG - Get token successed! Write to ./resource/token_backup
2022-11-18 04:26:21,141 - root - DEBUG - Get PAYLOAD={'name': '1', 'token': 'qp8j3mqkvh', 'tabN': 'movie_211229kl', 'topNo': 10, 'whr': 'question like "%1%" or byname like "%1%"', 'orderBy': 'isTop DESC, date_time', 'orderType': 'DESC', 'keys': 'question,answer,isTop,id'}
2022-11-18 04:26:21,142 - urllib3.connectionpool - DEBUG - Starting new HTTP connection (1): kelezj.com:80
2022-11-18 04:26:23,240 - urllib3.connectionpool - DEBUG - http://kelezj.com:80 "POST /v/api/getJuzi HTTP/1.1" 200 None
2022-11-18 04:26:23,241 - root - DEBUG - http://kelezj.com/v/api/getJuzi: <Response [200]>
2022-11-18 04:26:23,242 - urllib3.connectionpool - DEBUG - Starting new HTTP connection (1): kelezj.com:80
2022-11-18 04:26:23,710 - urllib3.connectionpool - DEBUG - http://kelezj.com:80 "POST /v/api/sortWeb HTTP/1.1" 200 None
2022-11-18 04:26:23,711 - root - DEBUG - http://kelezj.com/v/api/sortWeb: <Response [200]>
2022-11-18 04:26:23,713 - urllib3.connectionpool - DEBUG - Starting new HTTP connection (1): kelezj.com:80
2022-11-18 04:26:25,546 - urllib3.connectionpool - DEBUG - http://kelezj.com:80 "POST /v/api/getTop HTTP/1.1" 200 21
2022-11-18 04:26:25,547 - root - DEBUG - http://kelezj.com/v/api/getTop: <Response [200]>
2022-11-18 04:26:25,548 - urllib3.connectionpool - DEBUG - Starting new HTTP connection (1): kelezj.com:80
2022-11-18 04:26:26,068 - urllib3.connectionpool - DEBUG - http://kelezj.com:80 "POST /v/api/getDyfx HTTP/1.1" 200 21
2022-11-18 04:26:26,069 - root - DEBUG - http://kelezj.com/v/api/getDyfx: <Response [200]>
2022-11-18 04:26:26,071 - urllib3.connectionpool - DEBUG - Starting new HTTP connection (1): kelezj.com:80
2022-11-18 04:26:27,569 - urllib3.connectionpool - DEBUG - http://kelezj.com:80 "POST /v/api/getTTZJB HTTP/1.1" 200 None
2022-11-18 04:26:27,570 - root - DEBUG - http://kelezj.com/v/api/getTTZJB: <Response [200]>
2022-11-18 04:26:27,572 - urllib3.connectionpool - DEBUG - Starting new HTTP connection (1): kelezj.com:80
2022-11-18 04:26:28,843 - urllib3.connectionpool - DEBUG - http://kelezj.com:80 "POST /v/api/getGirls HTTP/1.1" 200 21
2022-11-18 04:26:28,844 - root - DEBUG - http://kelezj.com/v/api/getGirls: <Response [200]>
2022-11-18 04:26:28,845 - urllib3.connectionpool - DEBUG - Starting new HTTP connection (1): kelezj.com:80
2022-11-18 04:26:30,037 - urllib3.connectionpool - DEBUG - http://kelezj.com:80 "POST /v/api/getXiaoy HTTP/1.1" 200 11
2022-11-18 04:26:30,037 - root - DEBUG - http://kelezj.com/v/api/getXiaoy: <Response [200]>
2022-11-18 04:26:30,039 - urllib3.connectionpool - DEBUG - Starting new HTTP connection (1): kelezj.com:80
2022-11-18 04:26:30,255 - urllib3.connectionpool - DEBUG - http://kelezj.com:80 "POST /v/api/getGGang HTTP/1.1" 200 21
2022-11-18 04:26:30,256 - root - DEBUG - http://kelezj.com/v/api/getGGang: <Response [200]>
2022-11-18 04:26:30,257 - werkzeug - INFO - 127.0.0.1 - - [18/Nov/2022 04:26:30] "GET /api/video/1 HTTP/1.1" 200 -
2022-11-18 04:33:50,676 - werkzeug - INFO - 127.0.0.1 - - [18/Nov/2022 04:33:50] "GET /_static/src/browser/pages/global.css HTTP/1.1" 404 -
2022-11-18 04:33:50,677 - werkzeug - INFO - 127.0.0.1 - - [18/Nov/2022 04:33:50] "GET /_static/src/browser/pages/error.css HTTP/1.1" 404 -
2022-11-18 04:33:50,799 - werkzeug - INFO - 127.0.0.1 - - [18/Nov/2022 04:33:50] "GET /manifest.json HTTP/1.1" 404 -
2022-11-18 04:33:58,528 - werkzeug - INFO - 127.0.0.1 - - [18/Nov/2022 04:33:58] "GET /_static/src/browser/pages/error.css HTTP/1.1" 404 -
2022-11-18 04:33:58,529 - werkzeug - INFO - 127.0.0.1 - - [18/Nov/2022 04:33:58] "GET /_static/src/browser/pages/global.css HTTP/1.1" 404 -
2022-11-18 04:33:58,572 - werkzeug - INFO - 127.0.0.1 - - [18/Nov/2022 04:33:58] "GET /manifest.json HTTP/1.1" 404 -
2022-11-18 04:34:02,209 - werkzeug - INFO - 127.0.0.1 - - [18/Nov/2022 04:34:02] "GET /_static/src/browser/pages/global.css HTTP/1.1" 404 -
2022-11-18 04:34:02,210 - werkzeug - INFO - 127.0.0.1 - - [18/Nov/2022 04:34:02] "GET /_static/src/browser/pages/error.css HTTP/1.1" 404 -
2022-11-18 04:34:02,526 - werkzeug - INFO - 127.0.0.1 - - [18/Nov/2022 04:34:02] "GET /manifest.json HTTP/1.1" 404 -
2022-11-18 04:35:02,139 - werkzeug - INFO - 127.0.0.1 - - [18/Nov/2022 04:35:02] "GET /_static/src/browser/pages/global.css HTTP/1.1" 404 -
2022-11-18 04:35:02,140 - werkzeug - INFO - 127.0.0.1 - - [18/Nov/2022 04:35:02] "GET /_static/src/browser/pages/error.css HTTP/1.1" 404 -
2022-11-18 04:35:02,449 - werkzeug - INFO - 127.0.0.1 - - [18/Nov/2022 04:35:02] "GET /manifest.json HTTP/1.1" 404 -
2022-11-18 04:35:32,402 - werkzeug - INFO - 127.0.0.1 - - [18/Nov/2022 04:35:32] "GET / HTTP/1.1" 200 -
{"token": "dr0ibd0jf4", "user": "movie_211229kl"}
\ No newline at end of file
{"token": "qp8j3mqkvh", "user": "movie_211229kl"}
\ No newline at end of file
......@@ -2,7 +2,6 @@ import subprocess
def sh(command):
p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
print(type(p))
lines = []
for line in iter(p.stdout.readline, b''):
line = line.strip().decode("utf-8")
......@@ -13,5 +12,5 @@ def sh(command):
if __name__ == "__main__":
sh("pip3 config --global set global.index-url https://mirrors.aliyun.com/pypi/simple/")
sh("pip3 config --global set install.trusted-host mirrors.aliyun.com")
sh("pip3 install -r requirements.txt")
sh("pip3 install Flask")
print("\nComplete!")
\ No newline at end of file
import subprocess
def sh(command):
p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
lines = []
for line in iter(p.stdout.readline, b''):
line = line.strip().decode("utf-8")
print(">>>", line)
lines.append(line)
return lines
if __name__ == "__main__":
sh("python3 service/setup.py")
sh("npm config set registry https://registry.npm.taobao.org")
sh("cd web && npm install")
\ No newline at end of file
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
{
"recommendations": ["Vue.volar"]
}
# Vue 3 + TypeScript + Vite
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
## Recommended IDE Setup
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar)
## Type Support For `.vue` Imports in TS
Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using manual `h(...)` calls), you can enable Volar's Take Over mode by following these steps:
1. Run `Extensions: Show Built-in Extensions` from VS Code's command palette, look for `TypeScript and JavaScript Language Features`, then right click and select `Disable (Workspace)`. By default, Take Over mode will enable itself if the default TypeScript extension is disabled.
2. Reload the VS Code window by running `Developer: Reload Window` from the command palette.
You can learn more about Take Over mode [here](https://github.com/johnsoncodehk/volar/discussions/471).
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Vue + TS</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
此差异已折叠。
{
"name": "web",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"vue": "^3.2.41"
},
"devDependencies": {
"@vitejs/plugin-vue": "^3.2.0",
"typescript": "^4.6.4",
"vite": "^3.2.3",
"vue-tsc": "^1.0.9"
}
}
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
\ No newline at end of file
<script setup lang="ts">
// This starter template is using Vue 3 <script setup> SFCs
// Check out https://vuejs.org/api/sfc-script-setup.html#script-setup
import HelloWorld from './components/HelloWorld.vue'
</script>
<template>
<div>
<a href="https://vitejs.dev" target="_blank">
<img src="/vite.svg" class="logo" alt="Vite logo" />
</a>
<a href="https://vuejs.org/" target="_blank">
<img src="./assets/vue.svg" class="logo vue" alt="Vue logo" />
</a>
</div>
<HelloWorld msg="Vite + Vue" />
</template>
<style scoped>
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.vue:hover {
filter: drop-shadow(0 0 2em #42b883aa);
}
</style>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
\ No newline at end of file
<script setup lang="ts">
import { ref } from 'vue'
defineProps<{ msg: string }>()
const count = ref(0)
</script>
<template>
<h1>{{ msg }}</h1>
<div class="card">
<button type="button" @click="count++">count is {{ count }}</button>
<p>
Edit
<code>components/HelloWorld.vue</code> to test HMR
</p>
</div>
<p>
Check out
<a href="https://vuejs.org/guide/quick-start.html#local" target="_blank"
>create-vue</a
>, the official Vue + Vite starter
</p>
<p>
Install
<a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>
in your IDE for a better DX
</p>
<p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
</template>
<style scoped>
.read-the-docs {
color: #888;
}
</style>
import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
createApp(App).mount('#app')
:root {
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
font-size: 16px;
line-height: 24px;
font-weight: 400;
color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
}
a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}
body {
margin: 0;
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
}
h1 {
font-size: 3.2em;
line-height: 1.1;
}
button {
border-radius: 8px;
border: 1px solid transparent;
padding: 0.6em 1.2em;
font-size: 1em;
font-weight: 500;
font-family: inherit;
background-color: #1a1a1a;
cursor: pointer;
transition: border-color 0.25s;
}
button:hover {
border-color: #646cff;
}
button:focus,
button:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
}
.card {
padding: 2em;
}
#app {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}
@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
a:hover {
color: #747bff;
}
button {
background-color: #f9f9f9;
}
}
/// <reference types="vite/client" />
declare module '*.vue' {
import type { DefineComponent } from 'vue'
const component: DefineComponent<{}, {}, any>
export default component
}
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"module": "ESNext",
"moduleResolution": "Node",
"strict": true,
"jsx": "preserve",
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"lib": ["ESNext", "DOM"],
"skipLibCheck": true,
"noEmit": true
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
"references": [{ "path": "./tsconfig.node.json" }]
}
{
"compilerOptions": {
"composite": true,
"module": "ESNext",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()]
})
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册