我正在 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) 我正在使用selectionStart
andselectionEnd
来获取文本选择的起点和终点。
代码: 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) 我是 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
什么是可能的解决方案?
我有一个材质 UI 文本字段,其中包含一个onChange
. 这onChange
,就拿来event
执行函数了handleOnChange
。handleOnChange
在当前的实现中,每次更改时都会执行该函数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) 我正在从 移动nodemon
到ts-node-dev
但我无法使用 运行我的index.ts
文件ts-node-dev
。
我做了以下事情:
yarn add ts-node-dev --dev
在我的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-dev
或ts-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) 我正在尝试使用 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)
我正在尝试学习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)
该目录以以下方式组织:
我正在使用Bootstrap
withReactJS
来学习后者。
我想在我的应用程序中显示 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) 我正在使用 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 上会显示,cursor: "default"
但事实并非如此。
我刚刚使用以下命令安装了 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) reactjs ×5
javascript ×3
material-ui ×2
node.js ×2
npm ×2
typescript ×2
airflow ×1
css ×1
debouncing ×1
django ×1
ecmascript-6 ×1
graphql ×1
heroku ×1
onchange ×1
postman ×1
python ×1
ts-node-dev ×1
yarnpkg ×1