我正在Django做一个项目.我想在网页上显示来自摄像头的实时信息.但我不确定如何从网页上的凸轮返回实时反馈.这是我迄今为止尝试过的代码,但没有看到任何进展.
from django.shortcuts import render
from .forms import FaceAdditionForm
import cv2
import numpy as np
from django.http import StreamingHttpResponse
def capture_video_from_cam():
cap = cv2.VideoCapture(0)
currentFrame = 0
while True:
ret, frame = cap.read()
# Handles the mirroring of the current frame
frame = cv2.flip(frame,1)
currentFrame += 1
def addfaces(request):
add_faces_form = FaceAdditionForm()
if add_faces_form.is_valid():
add_faces_form.save()
return render(request, 'base.html', {'add_faces': add_faces_form})
def show_video_on_page(request):
resp = StreamingHttpResponse(capture_video_from_cam())
return render(request, 'base.html', {'video': resp})
Run Code Online (Sandbox Code Playgroud) 我无法重新启动我的mongodb
服务。在检查日志时,/var/log/mongodb/mongod.log
我收到以下错误:
cannot read certificate file: /root/ssl/mongodb.pem error:0200100D:system library:fopen:Permission denied
2019-11-23T17:04:27.679+0000 F CONTROL [main] Failed global initialization: InvalidSSLConfiguration: Can not set up PEM key file.
Run Code Online (Sandbox Code Playgroud)
我的/etc/mongod.conf
看起来像:
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# network interfaces
net:
port: 27017 …
Run Code Online (Sandbox Code Playgroud) 我尝试使用 AWS DMS Database Migration Service 和 Snowflake 作为源数据库。有什么办法可以实现这个目标吗?
我只能看到 IBMDB2、MySQL、SQL Server、Amazon Aurora、Oracle、SAP Sybase 等的选项,但没有看到 Snowflake 的选项。
SnowFlake 的 ODBC 字符串可以作为源端点放入吗?或者任何解决方法
我是熊猫新手。我有以下 pandas 数据框,其中包含以下值:
index print_statement timestamp
0 echo "I AM HAPPY2" 2018-11-12 08:01:00
1 echo "I AM HAPPY3" 2018-11-12 08:01:00
2 echo "I AM HAPPY1" 2018-11-12 08:01:00
3 echo "I AM HAPPY4" 2018-12-12 08:02:00
4 echo "I AM HAPPY5" 2018-12-13 08:02:00
Run Code Online (Sandbox Code Playgroud)
我想将 df 进行比较: - 假设我有一个 time_argument ,它是datetime.datetime(2018, 12, 12, 5, 1)
。我想将结果存储在另一个dataframe
时间戳> time_argument 中。
我尝试使用以下方法:
for index, row in df.iterrows():
date_store = row['time_to_expire']
if date_store.to_pydatetime() >= ii:
df_final = row
Run Code Online (Sandbox Code Playgroud)
但我没有得到想要的答案。
希望我能清楚地回答这个问题。