小编FBS*_*BSO的帖子

Django Heroku - ModuleNotFoundError:没有名为“django_heroku”的模块

我正在 heroku 上部署一个网站,但我遇到了一些问题。我的项目名为mysite-project.

我做了以下事情:

1)创建一个Procfile包含:

web: gunicorn mysite-project.wsgi

在我的项目的基本根目录(与 manage.py 相同的级别)。

2)应用程序/settings.py

import django_heroku 在顶部

django_heroku.settings(locals()) 在 settings.py 的底部

3)

pip install gunicorn
pip install django-heroku
pip freeze > requirements.txt
Run Code Online (Sandbox Code Playgroud)

4)如果我跑python manage.py runserver我得到:

ModuleNotFoundError: No module named 'django_heroku'
Run Code Online (Sandbox Code Playgroud)

django heroku

9
推荐指数
1
解决办法
2万
查看次数

类型“EventTarget”上不存在属性“selectionStart”

我正在使用selectionStartandselectionEnd来获取文本选择的起点和终点。

代码: https: //codesandbox.io/s/busy-gareth-mr04o

然而,我正在努力定义可以调用它们的事件类型。如果我使用any,代码可以正常工作,但我更想知道正确的事件。

我尝试过这些类型: Element React.SyntheticEvent<HTMLDivElement> <HTMLDivElement> 没有运气

export default function App() {
  const [startText, setStartText] = useState<number | undefined>();
  const [endText, setEndText] = useState<number | undefined>();

  const handleOnSelect = (event: any) => { <--- I CANNOT FIND THE RIGHT EVENT TYPE
    setStartText(event.target.selectionStart);
    setEndText(event.target.selectionEnd);
  };

  return (
    <Grid container direction="column" className="App">
      You can type here below:
      <TextField
        value={"This is a example, select a word from this string"}
        onSelect={(event) => handleOnSelect(event)}
      />
      <br …
Run Code Online (Sandbox Code Playgroud)

javascript typescript reactjs material-ui selection-api

8
推荐指数
1
解决办法
7791
查看次数

Apache 气流:没有模块名称“气流”

我是 apache 气流的新手,我正在遵循以下示例代码:https : //github.com/apache/airflow/blob/master/airflow/example_dags/tutorial.py

我将上面链接中的代码复制并粘贴到example.py我桌面上的一个文件夹中。

初始代码为:

from airflow import DAG
from airflow.operators.bash_operator import BashOperator
Run Code Online (Sandbox Code Playgroud)

如果我运行python example.py,我会收到错误消息:

从气流导入 DAG

ModuleNotFoundError: 没有名为“气流”的模块

即使我按如下方式安装了气流:

pip install apache-airflow

什么是可能的解决方案?

python airflow

7
推荐指数
1
解决办法
1万
查看次数

更改时去抖

我有一个材质 UI 文本字段,其中包含一个onChange. 这onChange,就拿来event执行函数了handleOnChangehandleOnChange在当前的实现中,每次更改时都会执行该函数event

是否可以debounce直接在 2000ms 后执行该函数event

我的文本字段

<TextField
  onChange={
    event =>
      handleOnChange(
      event.target.value,
      firstValue,
      secondValue,                            
    )
/>
Run Code Online (Sandbox Code Playgroud)

我的功能

const handleOnChange = (value, firstValue, secondValue) => {
  ...do something..
}
Run Code Online (Sandbox Code Playgroud)

我尝试了以下操作,但handleOnChange每次event更改时仍然会触发,而不是在 2000 毫秒后触发。

<TextField
  onChange={
    event =>
      _.debounce(handleOnChange(
      event.target.value,
      firstValue,
      secondValue,                            
    ), 2000)
/>
Run Code Online (Sandbox Code Playgroud)

javascript onchange debouncing reactjs

7
推荐指数
1
解决办法
5228
查看次数

未找到命令:ts-node-dev

我正在从 移动nodemonts-node-dev但我无法使用 运行我的index.ts文件ts-node-dev

我做了以下事情:

  1. yarn add ts-node-dev --dev

  2. 在我的package.json我有:

    "devDependencies": {
       ...
       "nodemon": "^1.19.2",
       "ts-node": "8.3.0",
       "ts-node-dev": "^1.0.0-pre.56",
       "typescript": "3.6.3"
    }
    
    Run Code Online (Sandbox Code Playgroud)

如果我运行ts-node-devts-node-dev src/index.ts收到错误: 找不到命令:ts-node-dev

我究竟做错了什么?在我看来,安装正确。

我的脚本

   "scripts": {
      "start": "nodemon --exec ts-node src/index.ts",
      "dev": "ts-node-dev src/index.ts"
   }
Run Code Online (Sandbox Code Playgroud)

node.js typescript ts-node-dev

7
推荐指数
1
解决办法
3万
查看次数

Postman - 使用 GraphQL 上传文件和其他参数

我正在尝试使用 Postman 将文件上传到 GraphQL。

我知道如何上传文件,但是,在我的突变中,我必须将 aString!Upload!.

我不确定我可以String!在邮递员中将其传递到哪里。

我的突变:

mutation AddBookImageOne($bookId: string, $bookImageOne: Upload!){
  addBookImageOne(bookId: $bookId, bookImageOne: $bookImageOne)
}
Run Code Online (Sandbox Code Playgroud)

我尝试传递bookId密钥variables,但不断收到错误消息:

"message": "未提供所需类型“String!”的变量“$bookId”。",

我检查了这个:Graphqlmutation to upload file with other fields but they use CURL

邮递员领域的“操作”是:

{"query":"mutation AddBookImageOne($bookId: String!, $bookImageOne: Upload!){\n  addBookImageOne(bookId: $bookId, bookImageOne: $bookImageOne)\n}"}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

postman graphql

7
推荐指数
1
解决办法
4726
查看次数

错误:纱线启动-错误找不到命令“启动”

我正在尝试学习React,并且正在使用一个私有仓库来开始它。

yarn start在仓库的目录中运行,但收到错误消息:

yarn run v1.13.0
error Command "start" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Run Code Online (Sandbox Code Playgroud)

我同时安装了node和yarn。

对于节点:

v10.15.0
node is /usr/local/bin/node
Run Code Online (Sandbox Code Playgroud)

对于纱线:

1.13.0
yarn is /usr/local/bin/yarn
Run Code Online (Sandbox Code Playgroud)

我尝试重新安装node和yarn,但收到相同的错误消息。此外,我试图通过消除纱线的机会,yarn cache clean但似乎无济于事。

package.json包含以下内容:

{
  "name": "02-Manipulating-Strings",
  "version": "1.0.0",
  "author": "ssaunier",
  "license": "UNLICENSED",
  "private": true,
  "devDependencies": {
    "eslint": "^4.7.2",
    "eslint-config-airbnb-base": "^12.0.0",
    "eslint-plugin-import": "^2.7.0",
    "jest": "^21.1.0"
  },
  "scripts": {
    "test": "(eslint lib || true) && jest"
  }
}
Run Code Online (Sandbox Code Playgroud)

该目录以以下方式组织:

项目目录

npm reactjs yarnpkg

6
推荐指数
3
解决办法
1万
查看次数

React bootstrap - 无效的钩子调用

我正在使用BootstrapwithReactJS来学习后者。

我想在我的应用程序中显示 Bootstrap 导航栏。

我的代码如下:

应用程序.js

import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import { Navbar } from "react-bootstrap";

function App() {
  return (
    <div className="App">

      <Navbar bg="dark" variant="dark">
        <Navbar.Brand href="#home">
          <img
            alt=""
            src="####"
            width="30"
            height="30"
            className="d-inline-block align-top"
          />
        // {' React Bootstrap'}
        </Navbar.Brand>
      </Navbar>

    </div>
  );
}

export default App;
Run Code Online (Sandbox Code Playgroud)

索引.html

<!DOCTYPE html>
<html lang="en">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" 
    integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" 
    crossorigin="anonymous">
    <!-- BOOTSTRAP -->
    <link rel="apple-touch-icon" href="logo192.png" />

    <link rel="manifest" …
Run Code Online (Sandbox Code Playgroud)

javascript ecmascript-6 reactjs react-bootstrap

6
推荐指数
1
解决办法
2093
查看次数

更改光标类型 - Material UI 扩展面板

我正在使用 MiU 组件“扩展面板”。当用户将鼠标悬停在面板上时,默认行为是将光标设置为pointer。我修改它以显示default光标。然而,它不起作用。

我的组件

<ExpansionPanel>
  <ExpansionPanelSummary
    className={classes.expasionPannelSummary}
  >
    ....rest of the code...
  </ExpansionPanelSummary
</ExpansionPanel>
Run Code Online (Sandbox Code Playgroud)

我的styles.js

expasionPannelSummary: {
    cursor: 'default',
    '&:hover': {
      cursor: 'default'
    },
    padding:them.spacing(1,3,1,3)
}
Run Code Online (Sandbox Code Playgroud)

CSS

如果我检查页面,CSS 上会显示,cursor: "default"但事实并非如此。

css reactjs material-ui

6
推荐指数
1
解决办法
3万
查看次数

zsh:找不到命令:npm

我刚刚使用以下命令安装了 Node 和 Yarn:

brew install node
brew install yarn --without-node

node -v       
v11.8.0

-a node  
node is /usr/local/bin/node

yarn -v       
1.13.0
type -a yarn
yarn is /usr/local/bin/yarn
Run Code Online (Sandbox Code Playgroud)

但是,如果我在终端中写的npm是“zsh:找不到命令:npm”

在我的:~/.zshrc我有:

ZSH=$HOME/.oh-my-zsh

# You can change the theme with another one:
#   https://github.com/robbyrussell/oh-my-zsh/wiki/themes
ZSH_THEME="robbyrussell"

# Useful plugins for Rails development with Sublime Text
plugins=(gitfast last-working-dir common-aliases sublime zsh-syntax-highlighting history-substring-search)

# Prevent Homebrew from reporting - https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Analytics.md
export HOMEBREW_NO_ANALYTICS=1

# Actually load Oh-My-Zsh
source "${ZSH}/oh-my-zsh.sh"
unalias rm # …
Run Code Online (Sandbox Code Playgroud)

node.js npm

5
推荐指数
2
解决办法
2万
查看次数