小编Goo*_*dea的帖子

Gunicorn,没有名为'myproject的模块

我正在新服务器上安装以前构建的网站.我不是原来的开发者.

我过去使用了Gunicorn + nginx来保持应用程序的活着(基本上遵循本教程),但我在这里遇到问题.

source venv/bin/activate,然后./manage.py runserver 0.0.0.0:8000运作良好,一切都按预期运行.我将其关闭并运行gunicorn --bind 0.0.0.0:8000 myproject.wsgi:application,并获得以下信息:

[2016-09-13 01:11:47 +0000] [15259] [INFO] Starting gunicorn 19.6.0
[2016-09-13 01:11:47 +0000] [15259] [INFO] Listening at: http://0.0.0.0:8000 (15259)
[2016-09-13 01:11:47 +0000] [15259] [INFO] Using worker: sync
[2016-09-13 01:11:47 +0000] [15262] [INFO] Booting worker with pid: 15262
[2016-09-13 01:11:47 +0000] [15262] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/var/www/myproject/venv/lib/python3.5/site-packages/gunicorn/arbiter.py", line 557, in spawn_worker
    worker.init_process()
  File "/var/www/myproject/venv/lib/python3.5/site-packages/gunicorn/workers/base.py", line 126, in …
Run Code Online (Sandbox Code Playgroud)

python django nginx gunicorn

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

打字稿:如何使用泛型参数作为对象键

是否可以编写一个接受字符串常量作为其参数之一的接口,并将其用作对象的键?

例如,假设我发出两个不同的 GraphQL 请求,它们都返回 a User,但键名不同:

const userByIdResult = {
  data: {
    userById: {
       id: 123,
       username: 'joseph'
    }
  }
}

const userByUsernameResult = {
  data: {
    userByUsername: {
       id: 123,
       username: 'joseph'
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

我想写一个通用接口会是这样的:

interface GraphQLResponse<QueryKey, ResponseType> {
  data: {
    [QueryKey]: ResponseType
  }
}

interface User {
    username: string
    id: string
}

type UserByIdResponse = GraphQLResponse<'userById', User>
type UserByUsernameResponse = GraphQLResponse<'userByUsername', User>
Run Code Online (Sandbox Code Playgroud)

但是,这行不通

typescript typescript-generics

14
推荐指数
1
解决办法
6336
查看次数

在多种类型上使用GraphQL Fragment

如果我的GraphQL架构中有多个类型共有的字段集,有没有办法做这样的事情?

type Address {
  line1: String
  city: String
  state: String 
  zip: String
}

fragment NameAndAddress on Person, Business {
  name: String
  address: Address
}

type Business {
   ...NameAndAddress
   hours: String
}

type Customer {
   ...NameAndAddress
   customerSince: Date
}
Run Code Online (Sandbox Code Playgroud)

apollo graphql

13
推荐指数
2
解决办法
3847
查看次数

如何在打字稿中使用带有元组的array.map?

每当我array.map在元组上使用时,Typescript 都会将其推断为通用数组。例如,这里有一些简单的 3x3 数独游戏:

const _ = ' ' // a "Blank"

type Blank = typeof _

type Cell = number | Blank

type Three = [Cell, Cell, Cell]

type Board = [Three, Three, Three]

const initialBoard: Board = [
    [_, 1, 3],
    [3, _, 1],
    [1, _, _],
]

// Adds a `2` to the first cell on the first row
function applyMove(board: Board): Board {
    // errors here
    const newBoard: Board =  board.map((row: Three, index: number) …
Run Code Online (Sandbox Code Playgroud)

tuples typescript

7
推荐指数
2
解决办法
2397
查看次数