小编Ben*_*Ben的帖子

Django测试运行器因“关系不存在”错误而失败

我在运行测试时看到错误,即 $ ./manage.py test --settings=my.test.settings django.db.utils.ProgrammingError: relation "<relation name>" does not exist

这是运行后./manage.py makemigrations && migrate。

python django postgresql django-rest-framework

5
推荐指数
1
解决办法
798
查看次数

与VisualForce的inputField数据绑定问题

我在Visualforce页面上得到了奇怪的结果(是的,Salesforce.com很icky,我知道).我的问题是我尝试使用inputField绑定自定义sObject上的数据,但在我的自定义控制器中,它无法识别用户输入数据.

以下是该页面的代码段:

<apex:pageBlockSection title="Enter New Fee" rendered="{!isRenderedFees}" >

    <apex:inputField value="{!workingFee.Fee_Type__c}"  required="True"/>
   <apex:inputField value="{!workingFee.Fee__c}"  required="True"/> 

    <apex:pageBlockSectionItem >
        <apex:CommandButton value="Save Fee" action="{!saveFee}"  immediate="true" />
        <apex:CommandButton value="Cancel" action="{!cancelFee}" immediate="true" />
    </apex:pageBlockSectionItem> 
 </apex:pageBlockSection>
Run Code Online (Sandbox Code Playgroud)

这是来自控制器的代码:

public Fee__c workingFee {get; set;}
 ....
public PageReference saveFee(){

    this.workingFee.Trade_Group__c = tradeGroup.id;
    try{
        System.debug('~~~~#~~#~~workingFee: '+workingFee.Fee_Type__c +'='+workingFee.Fee__c);
        upsert workingFee;
    }catch (System.Dmlexception e){
        ApexPages.addMessages(e);
        return null;
    }
    System.debug('~~~~#~~#~~workingFee: '+workingFee.Fee_Type__c +'='+workingFee.Fee__c);
    //savedFees.add(workingFee.clone());

    //re-render the page
    this.isRenderedFees = False;
    return null;
}
Run Code Online (Sandbox Code Playgroud)

我已确保workingFee属性不为null.每当我输入值后点击"保存费"按钮,它就会重新加载页面并给我一条消息"错误:缺少必填字段:[Fee__c]"(注意,这里的费用是一个货币字段 - 不是它期望这是一个sObject,是吗?)

saveFee()方法中的debug语句显示workingFee的重要字段为null,当我希望它们被赋予用户输入的值时.

salesforce visualforce apex-code

4
推荐指数
1
解决办法
9023
查看次数

Bootstrap轮播控件位置不正确

使用带有fontawesome的Bootstrap 3作为控件上的图标:除了图标位于轮播顶部而不是居中之外,一切看起来都不错.

<div class="row" id="landing">
            <div class="col-md-12">
                <div class="carousel slide" id="welcome-carousel" data-ride="carousel">
                    <!-- Indicators -->
                    <ol class="carousel-indicators">
                        <li data-target="#welcome-carousel" data-slide-to="0"></li>
                        <li data-target="#welcome-carousel" data-slide-to="1"></li>
                        <li data-target="#welcome-carousel" data-slide-to="2"></li>
                    </ol>

                    <!-- Slides -->
                    <div class="carousel-inner">
                        <div class="item active">
                            <img src="assets/images/WelcomeImage0.png" alt="" >
                            <div class="carousel-caption">
                                <h3>Blooh Blah Bleeh</h3>
                                <p>Important bizness talk</p>
                            </div><!-- end caption -->
                        </div><!-- end item -->
                    </div><!-- end carousel-inner slides -->

                    <!-- Controls -->
                    <a href="#welcome-carousel" class="left carousel-control" data-slide="prev">
                        <span class="fa-stack fa-lg">
                            <i class="fa fa-square-o fa-stack-2x"></i>
                            <i class="fa fa-angle-left fa-stack-1x"></i>
                        </span> …
Run Code Online (Sandbox Code Playgroud)

css twitter-bootstrap font-awesome

4
推荐指数
1
解决办法
7193
查看次数

express.js 中间件中的空参数对象

const app = express();
var router = require('express').Router({mergeParams: true});
const payloadMiddleware = (req, resp, next) => {
  console.log('A:',req.params);
  const {params, query} = req;
  const payload = req.body;
  req.my_params = { params, query, payload };
  next();
};

router.use(payloadMiddleware);

router.get('/inventory/:itemID/price', async function GetPrice(req, res, next) {
  console.log('B', req.my_params);
  console.log('C', req.params);
}

app.use(bodyParser.urlencoded({extended: true}));
app.use(bodyParser.json());
app.use('/', router);
server = app.listen(port);
Run Code Online (Sandbox Code Playgroud)

GET /inventory/abc/price?a=1&b=2 产量

A: {} # unclear why this is empty
B: { params: {},
     query: { a: '1', b: '2' },
     payload: …
Run Code Online (Sandbox Code Playgroud)

javascript node.js express ecmascript-6

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

docker python:3 中缺少环境变量,使用 docker-compose

虽然我的配置看起来不错,但我的python:3图像似乎没有预期的DJANGO_SECRET_KEY设置,至少在Dockerfile尝试运行迁移时

$ docker-compose config
services:
  api:
    build:
      context: /Users/ben/Projects/falcon/falcon-backend
      dockerfile: Dockerfile
    depends_on:
    - db
    - redis
    environment:
      DJANGO_SECRET_KEY: 'some-secret-that-works-elsewhere'
$
$ docker-compose up --build api
[...]
 Step 6/7 : RUN echo `$DJANGO_SECRET_KEY`
 ---> Running in fbfb569c0191

[...]
django.core.exceptions.ImproperlyConfigured: Set the DJANGO_SECRET_KEY env variable
ERROR: Service 'api' failed to build: The command '/bin/sh -c python manage.py migrate' returned a non-zero code: 1
Run Code Online (Sandbox Code Playgroud)

然而,最后一行CMD python manage.py runserver 0.0.0.0:8001 --settings=falcon.settings.dev-microservice确实按需要启动, 并设置了必要的环境变量。

# Dockerfile -- api …
Run Code Online (Sandbox Code Playgroud)

python django docker django-migrations docker-compose

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

检测相机是否在Flash中捕获

我在Flash AS3中使用Camera.getCamera()时遇到问题.如果有多个摄像头驱动程序,则不一定选择正确的摄像头驱动程序.如果默认是正确的,程序运行正常; 但是,如果选择其他驱动程序作为默认驱动程序,则网络摄像头上的LED不会亮起,也不会捕获任何视频.我可以循环浏览可用的凸轮并选择任意一个.但是,我不知道如何确定所选摄像机是否正确.它不会返回null.我考虑过使用camera.currentFPS,但目前还不清楚何时更新.我真的很难动态确定哪个相机可以做到这一点!

flash webcam actionscript-3

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

身份验证的REST服务设计

我想为身份验证和帐户管理设计REST服务.请让我知道以下是否满足REST风格.

POST http://server/security/authenticate?username=xxx&password=yyy
POST http://server/security/forgotPassword?username=xxx&email=yyy
PUT  http://server/security/changePassword?oldPassword=xxx&newPassword=yyy
Run Code Online (Sandbox Code Playgroud)

HTTP方法POST和PUT是否就在这里?由于身份验证不会修改任何内容,因此最好在此处使用GET吗?我很迷惑.

authentication rest

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

节点/ Docker节点无法找到已安装的绑定(通过Webpack)

我正在努力根据以下内容在docker容器中获取webpack开发服务器设置 node:latest

尽管尝试了Node Sass中的所有各种错误,都无法找到适合您当前环境的绑定,但我仍然遇到相同的错误:

web_1         | ERROR in ./~/css-loader!./~/sass-loader/lib/loader.js!./src/sass/style.sass
web_1         | Module build failed: Error: Missing binding /prject/node_modules/node-sass/vendor/linux-x64-59/binding.node
web_1         | Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 9.x
web
Run Code Online (Sandbox Code Playgroud)

这是当前

# Dockerfile
RUN yarn cache clean && yarn install --non-interactive --force
RUN rm -rf node_modules/node_sass
RUN npm rebuild node-sass
Run Code Online (Sandbox Code Playgroud)

重建步骤表明已安装二进制文件并签出:

Binary found at /advocate/node_modules/node-sass/vendor/linux-x64-59/binding.node
Testing binary
Binary is fine
Run Code Online (Sandbox Code Playgroud)

我也感到困惑的是

web_1         | Found bindings for the …
Run Code Online (Sandbox Code Playgroud)

node.js docker node-sass webpack-dev-server webpack-style-loader

0
推荐指数
1
解决办法
1252
查看次数

从Kustomize中的文本文件目录创建每个文件的Kubernetes机密

我有很多秘密的“环境变量”,我想进入kubernetes集群。当前,我在这些秘密的目录中,每个var都有一个对应的文件,该文件的命名方式与应该分配给该变量的方式相同。使用docker-compose,这给了我一个类似的脚本for secret in .secrets/*; do export "$(basename $secret)"="$(cat $secret)" ; done

我希望避免在kustomize文件中明确指定这些秘密中的每一个。是否有一种仅通过指定目录来为每个文件创建一个秘密的简单方法?

kubernetes kubectl kustomize

0
推荐指数
1
解决办法
55
查看次数