小编Sta*_*ord的帖子

Kubectl始终返回错误:yaml:在此上下文中不允许映射值

Kubectl命令总是返回此错误yaml:第2行:在此上下文中不允许映射值.即使我调用普通版本命令,配置命令等,也不确定是什么造成这种情况.

tessact@tessact-sys-1:~$ kubectl version
Client Version: version.Info{Major:"1", Minor:"4",
GitVersion:"v1.4.4",
GitCommit:"3b417cc4ccd1b8f38ff9ec96bb50a81ca0ea9d56",
GitTreeState:"clean", BuildDate:"2016-10-21T02:48:38Z",
GoVersion:"go1.6.3", Compiler:"gc", Platform:"linux/amd64"}
error: yaml: line 2: mapping values are not allowed in this context


tessact@tessact-sys-1:~/[some path]$ kubectl create -f kubernetes_configs/frontend.yaml
error: yaml: line 2: mapping values are not allowed in this context
Run Code Online (Sandbox Code Playgroud)

我使用的唯一yaml文件是

apiVersion: v1
kind: ReplicationController
metadata:
  name: frontend
  labels:
    name: frontend
spec:
  replicas: 3
  template:
    metadata:
      labels:
        name: frontend
    spec:
      containers:
      - name: trigger
        # Replace  with your project ID or use `make template`
        image: …
Run Code Online (Sandbox Code Playgroud)

yaml kubernetes kubectl

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

在 django-rest-framework 中序列化通用关系

我正在尝试学习如何在 Django-Rest-Framework 中使用 GenericRelations。我找到了序列化程序关系的文档页面并遵循了代码。我创建了模型:

class TaggedItem(models.Model):
    """
    Tags arbitary model instance using a generic relation.

    """
    tag_name = models.SlugField()
    content_type = models.ForeignKey(ContentType)
    object_id = models.PositiveIntegerField()
    tagged_object = GenericForeignKey('content_type', 'object_id')

    def __unicode__(self):
        return self.tag_name

class Bookmark(models.Model):
    """
    A bookmark consists of a URL, and 0 or more descriptive tags.
    """
    link_url = models.URLField()
    tags = GenericRelation(TaggedItem)

class Note(models.Model):
    """
    A note consists of some texts, and 0 or more descriptive tags
    """
    text = models.CharField(max_length=1000)
    tags = GenericRelation(TaggedItem)
Run Code Online (Sandbox Code Playgroud)

我创建了序列化程序: …

django serialization django-rest-framework

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

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

Azure Web应用程序的其他路径返回错误

我使用create-react-app创建了一个React应用。我正在尝试将其部署在Azure Web应用程序上。我创建了一个构建并使用FTP进行了部署。

当从应用程序进行内部重定向时,我可以看到该网页。但是,当我尝试直接转到URL时,出现此错误。

错误图片

例如:

如果基本网址是www.example.com,并且应用在内部重定向到/ new,则页面转到www.example.com/new。但是,如果我直接尝试加载www.example.com/new,则会收到上面显示的响应。在本地测试中不会发生这种情况

演示: 我在这里创建了一个演示

azure azure-web-sites reactjs create-react-app

5
推荐指数
3
解决办法
1192
查看次数