这真的很令人沮丧,我确实根据文档设置了所有内容,但是当我尝试独立运行 daphne 时,它不断抛出错误,当我使用python manage.py run server. 这非常令人沮丧,我似乎在其他任何地方都找不到类似的错误
2020-01-25 09:57:17,627 INFO Starting server at tcp:port=8000:interface=127.0.0.1
2020-01-25 09:57:17,628 INFO HTTP/2 support not enabled (install the http2 and tls Twisted extras)
2020-01-25 09:57:17,628 INFO Configuring endpoint tcp:port=8000:interface=127.0.0.1
2020-01-25 09:57:17,629 INFO Listening on TCP address 127.0.0.1:8000
127.0.0.1:44516 - - [25/Jan/2020:09:57:27] "WSCONNECTING /ws/score/" - -
2020-01-25 09:57:28,637 ERROR Exception inside application: Django can only handle ASGI/HTTP connections, not websocket.
File "/home/sofdeath/.local/lib/python3.7/site-packages/daphne/cli.py", line 30, in asgi
await self.app(scope, receive, send)
File "/home/sofdeath/.local/lib/python3.7/site-packages/django/core/handlers/asgi.py", line 146, …Run Code Online (Sandbox Code Playgroud) 将 laravel 5.8 升级到 laravel 6.x 后,我收到此错误:
Undefined class constant 'App\Providers\RouteServiceProvider::HOME'
Run Code Online (Sandbox Code Playgroud)
升级之前的应用登录系统是自定义的。升级到 laravel 6.x 后,我想使用 laravel 默认身份验证。我通过创建的认证php artisan ui:auth,我复制从新鲜laravel控制器app/Http/Controllers/Auth文件夹与身份验证有关的控制器一样- LoginController,RegisterController等等。
我应该怎么做才能解决上述错误?请有人帮我好吗?
laravel laravel-routing laravel-upgrade laravel-authentication laravel-6
我通常在我的应用程序中做的是使用工厂方法创建我所有的服务/dao/repo/clients
class Service:
def init(self, db):
self._db = db
@classmethod
def from_env(cls):
return cls(db=PostgresDatabase.from_env())
Run Code Online (Sandbox Code Playgroud)
当我创建应用程序时
service = Service.from_env()
Run Code Online (Sandbox Code Playgroud)
什么创建了所有依赖项
在我不想使用真实数据库的测试中,我只做 DI
service = Service(db=InMemoryDatabse())
Run Code Online (Sandbox Code Playgroud)
我想这与干净/十六进制架构相去甚远,因为 Service 知道如何创建数据库并知道它创建的数据库类型(也可能是 InMemoryDatabse 或 MongoDatabase)
我想在干净/十六进制架构中我会有
class DatabaseInterface(ABC):
@abstractmethod
def get_user(self, user_id: int) -> User:
pass
import inject
class Service:
@inject.autoparams()
def __init__(self, db: DatabaseInterface):
self._db = db
Run Code Online (Sandbox Code Playgroud)
我会设置注入器框架来做
# in app
inject.clear_and_configure(lambda binder: binder
.bind(DatabaseInterface, PostgresDatabase()))
# in test
inject.clear_and_configure(lambda binder: binder
.bind(DatabaseInterface, InMemoryDatabse()))
Run Code Online (Sandbox Code Playgroud)
我的问题是:
python architecture dependency-injection hexagonal-architecture clean-architecture
我正在尝试在单个堆栈中部署 S3 静态网站和 API 网关/lambda。
S3 静态站点中的 javascript 调用 lambda 来填充 HTML 列表,但它需要知道用于 lambda 集成的 API 网关 URL。
目前,我像这样生成了一个 RestApi ......
const handler = new lambda.Function(this, "TestHandler", {
runtime: lambda.Runtime.NODEJS_10_X,
code: lambda.Code.asset("build/test-service"),
handler: "index.handler",
environment: {
}
});
this.api = new apigateway.RestApi(this, "test-api", {
restApiName: "Test Service"
});
const getIntegration = new apigateway.LambdaIntegration(handler, {
requestTemplates: { "application/json": '{ "statusCode": "200" }' }
});
const apiUrl = this.api.url;
Run Code Online (Sandbox Code Playgroud)
但是在 cdk 部署上,apiUrl =
"https://${Token[TOKEN.39]}.execute-api.${Token[AWS::Region.4]}.${Token[AWS::URLSuffix.1]}/${Token[TOKEN.45]}/"
因此,直到静态站点需要该值之后,才会解析/生成 url。
如何计算/查找/获取 API 网关 URL 并更新 cdk …
我正在开发Laravel 5.8中的项目,最近,我也将其软件包依赖版本升级到了Laravel 6.0。该项目运行良好。但是,今天,我通过更新了作曲家,composer update,并将其升级为Laravel 6.2。之后,我遇到了一个错误:
App \ Http \ Controllers \ Auth \ ConfirmPasswordController不存在
然后,我通过安装了新的Laravel-6.2生成的基本脚手架,php artisan ui vue,然后通过生成了login/registration脚手架。php artisan ui vue --auth.之后,我发现ConfirmPasswordController.然后,我ConfirmPasswordController在运行的项目中手动创建并将所有代码复制ConfirmPasswordController到手动创建的代码中,ConfirmPasswordController.然后错误消失了。尽管我没有遇到与此相关的任何错误。但是,我对自己的方法感到困惑。我的做法正确吗?或者它有解决此问题的更好方法。我很困惑,如果php artisan ui vue --auth下次我要面对很多问题。有人会建议我正确的流程,我应该怎么做?
我几乎每天都在处理这个问题。我不明白这是怎么回事。
我在应用程序中使用反应形式,当我显示创建形式时,它运行良好。
但是,当我尝试显示编辑表单时,总是出现错误:
zone.js:192未捕获的错误:找不到路径为“ items-> 0-> content”的控件
我用下面的代码创建表单:
createFormGroup() {
return this.formBuilder.group({
items: this.formBuilder.array([this.createProductItems()]),
});
}
createProductItems() {
const productItems = [];
if (this.sourceProduct) {
this.sourceProduct.items.forEach(value => {
productItems.push(this.createProductItem());
});
}
return productItems;
}
Run Code Online (Sandbox Code Playgroud)
createProductItem方法a定义如下
createProductItem(): FormGroup {
return this.formBuilder.group({
content: ['', [Validators.required]],
quantity: ['', [Validators.required]]
});
}
Run Code Online (Sandbox Code Playgroud)
在我的模板中,我有以下内容html:
<div class="form-group row">
<label class="col-md-1 col-form-label label-main">{{"Items" | translate}}
<i (click)="addItem()" class="icon-button nb-plus-circled mr-1 fa-3x"></i>
</label>
<div class="col-md-9" formArrayName="items">
<div class="row"
*ngFor="let item of itemsArray.controls; let i = index;"> …Run Code Online (Sandbox Code Playgroud) 我正在使用 Rails 6 和新upsert_all方法。
这非常有用,但是,我有一些关于如何仅在新记录时添加列的问题。以created_at列为例。
如果记录是新的,您会想要添加这个(以及任何其他null: false没有default: ...
但是,created_at如果我正在更新,我也不想改变。
除了删除列之外,我将如何处理?
我知道在创建 .desktop 文件时,可以将 metadata::trusted 设置为 true 和 false,以便能够将图标作为可执行文件启动。然而,让我感兴趣的是以下事实:
当右键单击 .desktop 文件并“允许启动”时,它所做的唯一一件事就是将 metadata::trusted 设置为 true。但是,正如预期的那样,该图标会立即更改为 .desktop 文件 Icon= 中描述的图标。
但是,当通过命令行将 metadata::trusted 设置为 false 或 true 时,图标似乎不会改变其行为 $ gio set android-studio.desktop metadata::trusted false
一旦我手动刷新桌面(Alt + F2 >> 重启),环境就会刷新并且图标再次变为可执行,但整个环境都会重新启动。
那么,在设置了 metadata::trusted 之后,“允许/禁止启动”究竟做了什么?它如何在不刷新整个桌面的情况下刷新 .desktop 本身中的元数据?
我想运行区块链应用程序,但出现此错误。
npm 错误!代码 ELIFECYCLE
npm ERR!错误号 1
npm 错误号!scrypt@6.0.3 安装:node-gyp rebuild
npm 错误!退出状态 1
npm ERR!
npm 错误!scrypt@6.0.3 安装脚本失败。
npm 错误!这可能不是 npm 的问题。
上面可能有额外的日志输出。
我曾尝试删除 node_modules、npm缓存验证并npm install再次尝试。我已经卸载和重新安装npm和nodejs。我的npm版本是6.12.0和node版本v12.13.0
我使用 react native reanimated 创建了一个简单的动画,但我无法访问 Reanimated Value 的数值
我使用的是胜利本机饼图,我想制作一个简单的效果,饼角从 0 到 360,但我已经尝试过 react-native 动画 API,它可以很好地与添加侦听器配合使用,但我想使用重新动画来解决性能问题
我正在寻找的图表从 0 到 360 开始的动画效果
使用 react-native Animated API 正确运行:
const Chart = props => {
const { data, width, height } = props;
const endAngleAnimatedValue = new Value(0);
const [endAngle, setEndAngle] = useState(0);
const runTiming = Animated.timing(endAngleAnimatedValue, {
duration: 1000,
to: 360
});
useEffect(() => {
endAngleAnimatedValue.addListener(_endAngle => setEndAngle(_endAngle));
runTiming.start();
return () => {
endAngleAnimatedValue.removeAllListeners();
};
}, [endAngleAnimatedValue]);
return (
<VictoryPie
data={data}
width={width}
height={height} …Run Code Online (Sandbox Code Playgroud) javascript reactjs react-native victory-charts react-native-reanimated
javascript ×3
laravel ×2
laravel-6 ×2
angular6 ×1
architecture ×1
asgi ×1
aws-cdk ×1
aws-lambda ×1
blockchain ×1
daphne ×1
desktop ×1
django ×1
gnome ×1
launch ×1
node.js ×1
npm ×1
python ×1
react-native ×1
reactjs ×1
refresh ×1
ruby ×1
scrypt ×1