Django3 + Vue.js 前后端分离书籍添加项目Web开发实战
文章目录
- Django3后端项目创建
- 切换数据库
- 创建Django实战项目App
- 新建Vue.js前端项目
Django3后端项目创建
- 创建
Django
项目,采用Pycharm
或者命令行创建皆可。此处,以命令行方式作为演示,项目名为django_vue
。
django-admin startproject django_vue
项目结构如图所示
2. 同步数据库文件(Django
默认数据库为db.sqlite3
),执行同步过程如下:
切换路径到项目目录
cd django_vue
执行同步
python manage.py migrate
PS E:\coding\Django_learn\django_vue> python manage.py migrate
Operations to perform:Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:Applying contenttypes.0001_initial... OKApplying auth.0001_initial... OKApplying admin.0001_initial... OKApplying admin.0002_logentry_remove_auto_add... OKApplying admin.0003_logentry_add_action_flag_choices... OKApplying contenttypes.0002_remove_content_type_name... OKApplying auth.0002_alter_permission_name_max_length... OKApplying auth.0003_alter_user_email_max_length... OKApplying auth.0004_alter_user_username_opts... OKApplying auth.0005_alter_user_last_login_null... OKApplying auth.0006_require_contenttypes_0002... OKApplying auth.0007_alter_validators_add_error_messages... OKApplying auth.0008_alter_user_username_max_length... OKApplying auth.0009_alter_user_last_name_max_length... OKApplying auth.0010_alter_group_name_max_length... OKApplying auth.0011_update_proxy_permissions... OKApplying auth.0012_alter_user_first_name_max_length... OKApplying sessions.0001_initial... OK
PS E:\coding\Django_learn\django_vue>
- 启动
Django Server
,验证默认配置是否正常。
python manage.py runserver
PS E:\coding\Django_learn\django_vue> python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...System check identified no issues (0 silenced).
November 03, 2024 - 12:56:21
Django version 5.1.2, using settings 'django_vue.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.[03/Nov/2024 12:56:24] "GET / HTTP/1.1" 200 12068
Not Found: /favicon.ico
[03/Nov/2024 12:56:24] "GET /favicon.ico HTTP/1.1" 404 2212
切换数据库
- 将
Django
数据库更换为Mysql
登录mysql
mysql -u root -p
2. 创建数据库,数据库取名为django_vue_db
,并设置字符集为utf-8
。
mysql> CREATE DATABASE django_vue_db CHARACTER SET utf8;
Query OK, 1 row affected, 1 warning (0.15 sec)
-
安装
myslqclient
库 -
配置
settings.py
文件,配置Mysql
数据库引擎。
DATABASES = {'default': {'ENGINE': 'django.db.backends.mysql','NAME': 'django_vue_db','USER': 'root','PASSWORD': 'xxxxxxx','HOST': '127.0.0.1',}
}
- 执行同步操作,将数据迁移到
Mysql
。
python manage.py migrate
S E:\coding\Django_learn\django_vue> python manage.py migrate
>>
Operations to perform:Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:Applying contenttypes.0001_initial... OKApplying auth.0001_initial... OKApplying admin.0001_initial... OKApplying admin.0002_logentry_remove_auto_add... OKApplying admin.0003_logentry_add_action_flag_choices... OKApplying contenttypes.0002_remove_content_type_name... OKApplying auth.0002_alter_permission_name_max_length... OKApplying auth.0003_alter_user_email_max_length... OKApplying auth.0004_alter_user_username_opts... OKApplying auth.0005_alter_user_last_login_null... OKApplying auth.0006_require_contenttypes_0002... OKApplying auth.0007_alter_validators_add_error_messages... OKApplying auth.0008_alter_user_username_max_length... OKApplying auth.0009_alter_user_last_name_max_length... OKApplying auth.0010_alter_group_name_max_length... OKApplying auth.0011_update_proxy_permissions... OKApplying auth.0012_alter_user_first_name_max_length... OKApplying sessions.0001_initial... OK
- 验证是否切库成功,进入到
Mysql
客户端,查看django
初化表是否有生成。
mysql> use django_vue_db;
Database changed
mysql> show tables;
+----------------------------+
| Tables_in_django_vue_db |
+----------------------------+
| auth_group |
| auth_group_permissions |
| auth_permission |
| auth_user |
| auth_user_groups |
| auth_user_user_permissions |
| django_admin_log |
| django_content_type |
| django_migrations |
| django_session |
+----------------------------+
10 rows in set (0.00 sec)
- 运行
Django Server
,重新访问http://localhost:8000
如果能正常访问,过程没有报错,说明切换数据库已经成功了。
创建Django实战项目App
- 创建
Django App
,进入django_vue
项目主目录,输入如下命令:
python manage.py startapp api_test
App
创建完成后,目录结构如下所示:
并把api_test
加入到settings
文件中的installed_apps
列表里:
INSTALLED_APPS = ['django.contrib.admin','django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.contrib.messages','django.contrib.staticfiles','api_test',
]
- 在
api_test
目录下的models.py
里写一个model
:
from __future__ import unicode_literals
from django.db import models
class Book(models.Model):book_name = models.CharField(max_length=128)add_time = models.DateTimeField(auto_now_add=True)def __unicode__(self):return self.book_name
只有两个字段,书名book_name
和添加时间add_time
。如果没有指定主键的话Django
会自动新增一个自增id
作为主键。
- 在
api_test
目录下的views
里我们新增两个接口,一个是show_books
返回所有的书籍列表(通过JsonResponse
返回能被前端识别的json
格式数据),二是add_book
接受一个get
请求,往数据库里添加一条book
数据。
from django.shortcuts import render
from django.views.decorators.http import require_http_methods
from django.core import serializers
from django.http import JsonResponse
import jsonfrom .models import Book@require_http_methods(["GET"])
def add_book(request):response = {}try:book = Book(book_name=request.GET.get('book_name'))book.save()response['msg'] = 'success'response['error_num'] = 0except Exception as e:response['msg'] = str(e)response['error_num'] = 1return JsonResponse(response)@require_http_methods(["GET"])
def show_books(request):response = {}try:books = Book.objects.filter()response['list'] = json.loads(serializers.serialize("json", books))response['msg'] = 'success'response['error_num'] = 0except Exception as e:response['msg'] = str(e)response['error_num'] = 1return JsonResponse(response)
- 在
api_test
目录下,新增一个urls.py
文件,把我们新增的两个接口添加到路由里:
from django.conf.urls import url, include
from .views import *urlpatterns = [url(r"add_book$", add_book, ),url(r"show_books$", show_books, ),
]
- 我们还要把
api_test
下的urls
添加到项目django_vue
下的urls
中,才能完成路由:
from django.contrib import admin
from django.urls import path
from django.conf.urls import url, include
from django.contrib import admin
from django.views.generic import TemplateView
import api_test.urlsurlpatterns = [url(r"^admin/", admin.site.urls),url(r'^api/', include(api_test.urls)),
]
- 在项目的根目录,输入命令:
python manage.py makemigrations api_test
python manage.py migrate
- 查询数据库,看到
book
表已经自动创建了:
PS E:\coding\Django_learn\django_vue> python manage.py makemigrations api_test
>>
Migrations for 'api_test':api_test\migrations\0001_initial.py+ Create model Book
PS E:\coding\Django_learn\django_vue> python manage.py migrate
>>
Operations to perform:Apply all migrations: admin, api_test, auth, contenttypes, sessions
Running migrations:Applying api_test.0001_initial... OK
Django
生成的表名将以app
名加上model
中的类名组合而成。
新建Vue.js前端项目
有关Vue
的模块(包括vue
)可以使用node
自带的npm
包管理器安装。推荐使用淘宝的 cnpm
命令行工具代替默认的 npm
。
npm install -g cnpm --registry=https://registry.npm.taobao.org
- 先用
cnpm
安装vue-cli
脚手架工具(vue-cli
是官方脚手架工具,能迅速帮你搭建起vue
项目的框架):
cnpm install -g vue-cli
PS E:\coding\Django_learn\django_vue> cnpm install -g vue-cli
>>
Downloading vue-cli to C:\Users\lenovo\AppData\Roaming\npm\node_modules\vue-cli_tmp
Copying C:\Users\lenovo\AppData\Roaming\npm\node_modules\vue-cli_tmp\.store\vue-cli@2.9.6\node_modules\vue-cli to C:\Users\lenovo\AppData\Roaming\npm\node_modules\vue-cli
Installing vue-cli's dependencies to C:\Users\lenovo\AppData\Roaming\npm\node_modules\vue-cli/node_modules
[1/20] uid@0.0.2 installed at node_modules\.store\uid@0.0.2\node_modules\uid
[2/20] commander@^2.9.0 installed at node_modules\.store\commander@2.20.3\node_modules\commander
[3/20] semver@^5.1.0 installed at node_modules\.store\semver@5.7.2\node_modules\semver
[4/20] tildify@^1.2.0 installed at node_modules\.store\tildify@1.2.0\node_modules\tildify
[5/20] user-home@^2.0.0 installed at node_modules\.store\user-home@2.0.0\node_modules\user-home
[6/20] validate-npm-package-name@^3.0.0 installed at node_modules\.store\validate-npm-package-name@3.0.0\node_modules\validate-npm-package-name
[7/20] coffee-script@1.12.7 installed at node_modules\.store\coffee-script@1.12.7\node_modules\coffee-script
[8/20] multimatch@^2.1.0 installed at node_modules\.store\multimatch@2.1.0\node_modules\multimatch
[9/20] minimatch@^3.0.0 installed at node_modules\.store\minimatch@3.1.2\node_modules\minimatch
[10/20] read-metadata@^1.0.0 installed at node_modules\.store\read-metadata@1.0.0\node_modules\read-metadata
[11/20] consolidate@^0.14.0 installed at node_modules\.store\consolidate@0.14.5\node_modules\consolidate
[12/20] chalk@^2.1.0 installed at node_modules\.store\chalk@2.4.2\node_modules\chalk
[13/20] rimraf@^2.5.0 installed at node_modules\.store\rimraf@2.7.1\node_modules\rimraf
[14/20] ora@^1.3.0 installed at node_modules\.store\ora@1.4.0\node_modules\ora
[15/20] request@^2.67.0 installed at node_modules\.store\request@2.88.2\node_modules\request
[16/20] download-git-repo@^1.0.1 installed at node_modules\.store\download-git-repo@1.1.0\node_modules\download-git-repo
[17/20] handlebars@^4.0.5 installed at node_modules\.store\handlebars@4.7.8\node_modules\handlebars
[18/20] metalsmith@^2.1.0 installed at node_modules\.store\metalsmith@2.6.3\node_modules\metalsmith
[19/20] async@^2.4.0 installed at node_modules\.store\async@2.6.4\node_modules\async
[20/20] inquirer@^6.0.0 installed at node_modules\.store\inquirer@6.5.2\node_modules\inquirer
deprecate consolidate@^0.14.0 Please upgrade to consolidate v1.0.0+ as it has been modernized with several long-awaited fixes implemented. Maintenance is supported by Forward Email at https://forwardemail.net ; follow/watch https://github.com/ladjs/consolidate for updates and release changelog
deprecate rimraf@^2.5.0 Rimraf versions prior to v4 are no longer supported
deprecate request@^2.67.0 request has been deprecated, see https://github.com/request/request/issues/3142
deprecate rimraf@2.7.1 › glob@^7.1.3 Glob versions prior to v9 are no longer supported
deprecate request@2.88.2 › har-validator@~5.1.3 this library is no longer supported
deprecate rimraf@2.7.1 › glob@7.2.3 › inflight@^1.0.4 This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
deprecate request@2.88.2 › uuid@^3.3.2 Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
Run 1 script(s) in 1s.
All packages installed (231 packages installed from npm registry, used 12s(network 12s), speed 514.2KB/s, json 222(1.25MB), tarball 4.73MB, manifests cache hit 0, etag hit 0 / miss 0)
[vue-cli@2.9.6] link C:\Users\lenovo\AppData\Roaming\npm\vue@ -> C:\Users\lenovo\AppData\Roaming\npm\node_modules\vue-cli\bin\vue
[vue-cli@2.9.6] link C:\Users\lenovo\AppData\Roaming\npm\vue-init@ -> C:\Users\lenovo\AppData\Roaming\npm\node_modules\vue-cli\bin\vue-init
[vue-cli@2.9.6] link C:\Users\lenovo\AppData\Roaming\npm\vue-list@ -> C:\Users\lenovo\AppData\Roaming\npm\node_modules\vue-cli\bin\vue-list
- 安装好后,在
django_vue
项目根目录下,新建一个前端工程目录:
vue-init webpack frontend
PS E:\coding\Django_learn\django_vue> vue-init webpack frontend
>>? Project name frontend
? Project description A Vue.js project
? Author aliyun5171063201 <19377056@buaa.edu.cn>
? Vue build standalone
? Install vue-router? Yes
? Use ESLint to lint your code? Yes
? Pick an ESLint preset Standard
? Set up unit tests Yes
? Pick a test runner jest
? Setup e2e tests with Nightwatch? Yes
? Should we run `npm install` for you after the project has been created? (recommended) npmvue-cli · Generated "frontend".# Installing project dependencies ...
# ========================npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm warn deprecated rimraf@2.7.1: Rimraf versions prior to v4 are no longer supported
npm warn deprecated har-validator@5.1.5: this library is no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm warn deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm warn deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm warn deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm warn deprecated flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
npm warn deprecated acorn-dynamic-import@2.0.2: This is probably built in to whatever tool you're using. If you still
need it... idk
npm warn deprecated consolidate@0.14.5: Please upgrade to consolidate v1.0.0+ as it has been modernized with several long-awaited fixes implemented. Maintenance is supported by Forward Email at https://forwardemail.net ; follow/watch https://github.com/ladjs/consolidate for updates and release changelog
npm warn deprecated json3@3.3.2: Please use the native JSON object instead of JSON 3
npm warn deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm warn deprecated copy-concurrently@1.0.5: This package is no longer supported.
npm warn deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm warn deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm warn deprecated socks@1.1.10: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0
npm warn deprecated q@1.4.1: You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScript promise now. Thank you literally everyone for joining me in this bet against the odds. Be excellent to each other.
npm warn deprecated
npm warn deprecated (For a CapTP with native promises, see @endo/eventual-send and @endo/captp)
npm warn deprecated abab@2.0.6: Use your platform's native atob() and btoa() methods instead
npm warn deprecated domexception@1.0.1: Use your platform's native DOMException instead
npm warn deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
npm warn deprecated left-pad@1.3.0: use String.prototype.padStart()
npm warn deprecated fs-write-stream-atomic@1.0.10: This package is no longer supported.
npm warn deprecated move-concurrently@1.0.1: This package is no longer supported.
npm warn deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm warn deprecated sane@2.5.2: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm warn deprecated eslint-loader@1.9.0: This loader has been deprecated. Please use eslint-webpack-plugin
npm warn deprecated chromedriver@2.46.0: Chromedriver download url has changed. Use version 114.0.2 or newer.
npm warn deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm warn deprecated html-webpack-plugin@2.30.1: out of support
npm warn deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm warn deprecated rimraf@2.6.3: Rimraf versions prior to v4 are no longer supported
npm warn deprecated glob@7.0.5: Glob versions prior to v9 are no longer supported
npm warn deprecated extract-text-webpack-plugin@3.0.2: Deprecated. Please use https://github.com/webpack-contrib/mini-css-extract-plugin
npm warn deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm warn deprecated uglify-es@3.3.10: support for ECMAScript is superseded by `uglify-js` as of v3.13.0 ([WARNING] Use 3.3.9 instead of 3.3.10, reason: see https://github.com/mishoo/UglifyJS2/issues/2896)
npm warn deprecated bfj-node4@5.3.1: Switch to the `bfj` package for fixes and new features!
npm warn deprecated babel-eslint@8.2.6: babel-eslint is now @babel/eslint-parser. This package will no longer receive
updates.
npm warn deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm warn deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm warn deprecated svgo@0.7.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm warn deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm warn deprecated vue@2.7.16: Vue 2 has reached EOL and is no longer actively maintained. See https://v2.vuejs.org/eol/ for more details.
npm warn deprecated eslint@4.19.1: This version is no longer supported. Please see https://eslint.org/version-support
for other options.
npm warn deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.added 1908 packages in 2m122 packages are looking for fundingrun `npm fund` for detailsRunning eslint --fix to comply with chosen preset rules...
# ========================> frontend@1.0.0 lint
> eslint --ext .js,.vue src test/unit test/e2e/specs --fix
在创建项目的过程中会弹出一些与项目相关的选项需要回答,按照真实情况进行输入即可。
- 安装
vue
依赖模块
cd frontend
cnpm install
cnpm install vue-resource
cnpm install element-ui
PS E:\coding\Django_learn\django_vue> cnpm install vue-resource
√ Linked 31 latest versions fallback to E:\coding\Django_learn\django_vue\node_modules\.store\node_modules
tly_updates.txt)Today:→ vue-resource@1.5.3 › got@11.8.6 › @types/cacheable-request@6.0.3 › @types/node@*(22.8.7) (12:02:53)
√ Installed 1 packages on E:\coding\Django_learn\django_vue
√ All packages installed (32 packages installed from npm registry, used 2s(network 2s), speed 387.11KB/s, json 25(139.05KB), tarball 652.98KB, manifests cache hit 6, etag hit 6 / miss 0)dependencies:
+ vue-resource ^1.5.3PS E:\coding\Django_learn\django_vue> cnpm install element-ui
>>
√ Linked 10 latest versions fallback to E:\coding\Django_learn\django_vue\node_modules\.store\node_modules
√ Linked 2 public hoist packages to E:\coding\Django_learn\django_vue\node_modules
peerDependencies WARNING element-ui@latest requires a peer of vue@^2.5.17 but none was installed, packageDir: E:\coding\Django_learn\django_vue\node_modules\.store\element-ui@2.15.14\node_modules\element-ui
deprecate element-ui@2.15.14 › async-validator@1.8.5 › babel-runtime@6.26.0 › core-js@^2.4.0 core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web
compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
√ Run 1 script(s) in 176ms.
√ Installed 1 packages on E:\coding\Django_learn\django_vue
√ All packages installed (10 packages installed from npm registry, used 4s(network 4s), speed 603.25KB/s, json 10(174.66KB), tarball 2.37MB, manifests cache hit 0, etag hit 0 / miss 0)dependencies:
+ element-ui ^2.15.14
- 现在我们可以看到整个文件目录结构是这样的:
6. 在frontend
目录src
下包含入口文件main.js
,入口组件App.vue
等。后缀为vue
的文件是Vue.js
框架定义的单文件组件,其中标签中的内容可以理解为是类html
的页面结构内容。
- 在
src/component
文件夹下新建一个名为Home.vue
的组件,通过调用之前在Django
上写好的api
,实现添加书籍和展示书籍信息的功能。在样式组件上我们使用了饿了么团队推出的element-ui
,这是一套专门匹配Vue.js
框架的功能样式组件。
相关文章:

Django3 + Vue.js 前后端分离书籍添加项目Web开发实战
文章目录 Django3后端项目创建切换数据库创建Django实战项目App新建Vue.js前端项目 Django3后端项目创建 创建Django项目,采用Pycharm或者命令行创建皆可。此处,以命令行方式作为演示,项目名为django_vue。 django-admin startproject djang…...

楼梯区域分割系统:Web效果惊艳
楼梯区域分割系统源码&数据集分享 [yolov8-seg-FocalModulation&yolov8-seg-GFPN等50全套改进创新点发刊_一键训练教程_Web前端展示] 1.研究背景与意义 项目参考ILSVRC ImageNet Large Scale Visual Recognition Challenge 项目来源AAAI Global Al l…...

Day10加一
给定一个由 整数 组成的 非空 数组所表示的非负整数,在该数的基础上加一。 最高位数字存放在数组的首位, 数组中每个元素只存储单个数字。 你可以假设除了整数 0 之外,这个整数不会以零开头。 class Solution {public int[] plusOne(int[] di…...

UTF-8简介
UTF-8 UTF-8(8-bit Unicode Transformation Format)是一种针对Unicode的可变长度字符编码,也是一种前缀码。它可以用一至四个字节对Unicode字符集中的所有有效编码点进行编码,属于Unicode标准的一部分,最初由肯汤普逊…...

基于Openwrt系统架构,实现应用与驱动的实例。
一、在openwrt系统架构,编写helloworld的应用程序。 第一步先创建目录,项目代码要放在 openwrt根目下的 package 目录中,这里源码写在了 hellworld 的 src 目录下,因为外层还有需要编写的文件。 mkdir -p ~/openwrt/package/hel…...

SQL进阶技巧:如何利用三次指数平滑模型预测商品零售额?
目录 0 问题背景 1 数据准备 2 问题解决 2.1 模型构建 (1)符号规定 (2)基本假设...

HTB:Cicada[WriteUP]
目录 连接至HTB服务器并启动靶机 使用nmap对靶机进行开放端口扫描 使用nmap对靶机开放端口进行脚本、服务信息扫描 首先尝试空密码连接靶机SMB服务 由于不知道账户名,这里我们使用crackmapexec对smb服务进行用户爆破 通过该账户连接至靶机SMB服务器提取敏感信…...

小张求职记四
学校食堂的装修富丽堂皇,像个金碧辉煌的宫殿,可实际上却充斥着廉价的塑料制品和刺鼻的消毒水味。这金玉其外败絮其中的景象,与食堂承包商的“精明算计”如出一辙。 小张和小丽应约来到了一个档口下,“红烧肉”,之前就是…...

适用于 c++ 的 wxWidgets框架源码编译SDK-windows篇
本文章记录了下载wxWidgets源码在windows 11上使用visual Studio 2022编译的全过程,讲的不详细请给我留言,让我知道错误并改进。 本教程是入门级。有更深入的交流可以留言给我。 如今互联网流行现在大家都忘记了这块桌面的开发,我认为桌面应用还是有用武之地,是WEB无法替代…...

flink 内存配置(二):设置TaskManager内存
TaskManager在Flink中运行用户代码。根据需要配置内存使用,可以极大地减少Flink的资源占用,提高作业的稳定性。 注意下面的讲解适用于TaskManager 1.10之后的版本。与JobManager进程的内存模型相比,TaskManager内存组件具有类似但更复杂的结构…...

【C++ 算法进阶】算法提升八
复杂计算 (括号问题相关递归套路 重要) 题目 给定一个字符串str str表示一个公式 公式里面可能有整数 - * / 符号以及左右括号 返回最终计算的结果 题目分析 本题的难点主要在于可能会有很多的括号 而我们直接模拟现实中的算法的话code会难写 要考虑…...

阿里云实时数据仓库HologresFlink
1. 实时数仓Hologres特点 专注实时场景:数据实时写入、实时更新,写入即可见,与Flink原生集成,支持高吞吐、低延时、有模型的实时数仓开发,满足业务洞察实时性需求。 亚秒级交互式分析:支持海量数据亚秒级交…...

生成式语言模型的文本生成评价指标(从传统的基于统计到现在的基于语义)
文本生成评价指标 以 BLEU 为代表的基于统计的文本评价指标基于 BERT 等预训练模型的文本评价指标 1.以 BLEU 为代表的基于统计的文本评价指标 1.BLEU(Bilingual Evaluation Understudy, 双语评估辅助工具) 所有评价指标的鼻祖,核心思想是比较 候选译文 和 参考…...

【网安案例学习】暴力破解攻击(Brute Force Attack)
### 案例与影响 暴力破解攻击在历史上曾导致多次重大安全事件,特别是在用户数据泄露和账户被盗的案例中。随着计算能力的提升和密码管理技术的进步,暴力破解的威胁虽然有所减弱,但仍需警惕,特别是在面对高价值目标时。 【故事一…...

时间序列预测(十八)——实现配置管理和扩展命令行参数解析器
如图,这是一个main,py文件,在此代码中,最开始定义了许多模型参数,为了使项目更加灵活和可扩展,便于根据不同的需求调整参数和配置,可以根据实际需要扩展参数和配置项。 下面是如何实现配置管理和扩展命令行…...

Vue问题汇总解决
作者:fyupeng 技术专栏:☞ https://github.com/fyupeng 项目地址:☞ https://github.com/fyupeng/distributed-blog-system-api 留给读者 我们经常在使用Vue开发遇到一些棘手的问题,解决后通常要进行总结,避免下次重复…...

Spark学习
Spark简介 1.Spark是什么 首先spark是一个计算引擎,而不是存储工具,计算引擎有很多: 第一代:MapReduce廉价机器实现分布式大数据处理 第二代:Tez基于MR优化了DAG,性能比MR快一些 第三代:Spark…...

一些小细节代码笔记汇总
Python cv2抓取摄像头图片保存到本地 import cv2 import datetime, ossavePath "E:/Image/"if not os.path.exists(savePath):os.makedirs(savePath)cap cv2.VideoCapture(0) capture Falseif not cap.isOpened():print("无法打开摄像头")exit()while…...

L4.【LeetCode笔记】链表题的VS平台调试代码
不用调用87.【C语言】数据结构之链表的头插和尾插文章提到的头插函数 记下这个模板代码,可用于在Visual Studio上调试出问题的测试用例 如创建链表[1,2,3,4,5] #include <stdilb.h> // Definition for singly-linked list.struct ListNode {int val;struct ListNode *…...

JavaCV 之高斯滤波:图像降噪与细节保留的魔法
🧑 博主简介:CSDN博客专家,历代文学网(PC端可以访问:https://literature.sinhy.com/#/literature?__c=1000,移动端可微信小程序搜索“历代文学”)总架构师,15年工作经验,精通Java编程,高并发设计,Springboot和微服务,熟悉Linux,ESXI虚拟化以及云原生Docker和K8s…...

VsCode显示空格
ctrl shift p选择Preferences: Open User Settings (JSON) 加上"editor.renderWhitespace": "all" {"cmake.configureOnOpen": true,"files.encoding": "gb2312","editor.fontVariations": false,"edito…...

.Net C# 基于EFCore的DBFirst和CodeFirst
DBFirst和CodeFirst 1 概念介绍 1.1 DBFirst(数据库优先) 含义:这种模式是先创建数据库架构,包括表、视图、存储过程等数据库对象。然后通过实体框架(Entity Framework)等工具,根据已有的数据…...

w012基于springboot的社区团购系统设计
🙊作者简介:拥有多年开发工作经验,分享技术代码帮助学生学习,独立完成自己的项目或者毕业设计。 代码可以私聊博主获取。🌹赠送计算机毕业设计600个选题excel文件,帮助大学选题。赠送开题报告模板ÿ…...

笔记本降频超鬼锁屏0.39电脑卡到不行解决办法实操记录
1、最开始没发现cpu问题,我发现我电脑突然异常的卡顿,最开始我怀疑是不是微软win用久了或者自动更新导致的问题,于是自己重装了操作系统 发现问题依然存在 2、我怀疑难道我的 cpu 内存 固态硬盘 其中一个有点问题?心想要是硬盘的…...

优选算法第四讲:前缀和模块
优选算法第四讲:前缀和模块 1.[模板]前缀和2.【模板】二维前缀和3.寻找数组的中心下标4.除自身以外数组的乘积5.和为k的子数组6.和可被k整除的子数组7.连续数组8.矩阵区域和 1.[模板]前缀和 链接: link #include <iostream> #include <vector> using…...

ubuntu20.04 加固方案-设置限制su命令用户组
一、编辑/etc/pam.d/su配置文件 打开终端。 使用文本编辑器(如vim)编辑/etc/pam.d/su文件。 vim /etc/pam.d/su 二、添加配置参数 在打开的配置文件的中,添加以下参数: auth required pam_wheel.so 创建 wheel 组 并添加用户 …...

TDengine数据备份与恢复
TDengine数据备份与恢复 一、数据备份和恢复介绍二、基于 taosdump 进行数据备份恢复三、基于 taosExplorer 进行数据备份恢复3.1 taosExplorer 的安装与配置3.2 使用taosExplorer 进行数据备份 一、数据备份和恢复介绍 官网地址:TDengine - 数据备份和恢复 为了防止…...

2024最新的开源博客系统:vue3.x+SpringBoot 3.x 前后端分离
本文转载自:https://fangcaicoding.cn/article/54 大家好!我是方才,目前是8人后端研发团队的负责人,拥有6年后端经验&3年团队管理经验,截止目前面试过近200位候选人,主导过单表上10亿、累计上100亿数据…...

研究中的“异质性”、“异质性结果”是指?
“异质性”这个词在统计学和研究中指的是数据、现象或群体之间的差异,即不同个体、组别、区域或时间点的表现或特征并不相同。相对的概念是“同质性”,即所有个体或组别在某一方面表现相同或接近。 异质性(Heterogeneity)的含义 …...

Springboot整合AOP和redis
aop pom.xml <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-aop</artifactId> </dependency> 开启自动代理 注意:在完成了引入AOP依赖包后,一般来说并不需要去做其他…...