我从Google API Oauth收到此错误:
idpiframe_initialization_failed",详细信息:"不是客户端的有效来源:http://127.0.0....为项目的客户端ID列出此来源
我正在尝试从此本地路径发送请求:
我已将此URL添加到Authorized JavaScript origin部分:
这是我的代码:
<!-- The top of file index.html -->
<html itemscope itemtype="http://schema.org/Article">
<head>
<!-- BEGIN Pre-requisites -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js">
</script>
<script src="https://apis.google.com/js/client:platform.js?onload=start" async defer>
</script>
<!-- END Pre-requisites -->
<!-- Continuing the <head> section -->
<script>
function start() {
gapi.load('auth2', function() {
auth2 = gapi.auth2.init({
client_id: 'MY CLIENT ID.apps.googleusercontent.com',
// Scopes to request in addition to 'profile' and 'email'
//scope: 'https://www.google.com/m8/feeds/'
});
});
}
</script>
</head>
<body>
<button id="signinButton">Sign in …
Run Code Online (Sandbox Code Playgroud) 我正在尝试在Ubuntu机器上更新我的PHP 5.5.9到5.6.
但是当我跑步时:
sudo add-apt-repository ppa:ondrej/php5-5.6
Run Code Online (Sandbox Code Playgroud)
我越来越:
Cannot add PPA: 'ppa:ondrej/php5-5.6'.
Please check that the PPA name or format is correct.
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?
我跑了:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php5
Run Code Online (Sandbox Code Playgroud)
但是当我跑步时:
php5 -v
Run Code Online (Sandbox Code Playgroud)
我仍然得到PHP 5.5.9:
PHP 5.5.9-1ubuntu4.20 (cli) (built: Oct 3 2016 13:00:37)
Run Code Online (Sandbox Code Playgroud) 我正在尝试通过AWS SES发送电子邮件,但我收到此错误:
botocore.exceptions.ClientError: An error occurred (InvalidParameterValue) when calling the SendEmail operation: Illegal address
Run Code Online (Sandbox Code Playgroud)
我已经验证了我发送的电子邮件.这是我的代码:
import boto3
client = boto3.client(
'ses',
aws_access_key_id=AWS_ACCESS_KEY,
aws_secret_access_key=AWS_SECRET_KEY
)
response = client.send_email(
Destination={
'ToAddresses': [
'xxx@xxx.com',
],
},
Message={
'Body': {
'Html': {
'Charset': 'UTF-8',
'Data': 'This message body contains HTML formatting. It can, for example, contain links like this one: <a class="ulink" href="http://docs.aws.amazon.com/ses/latest/DeveloperGuide" target="_blank">Amazon SES Developer Guide</a>.',
},
'Text': {
'Charset': 'UTF-8',
'Data': 'This is the message body in text format.',
}, …
Run Code Online (Sandbox Code Playgroud) 我正在尝试在Ubuntu EC2机器(t2.medium)中运行弹性搜索.
但我收到的消息是:
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
Run Code Online (Sandbox Code Playgroud)
如何增加vm.max_map_count?
有人在模板中使用Python Social Auth和Django 有一个开放的例子吗?
我看了他们的Github回购,在django exmaple中,没有关于如何在模板中处理它(例如登录,注销等).
我正在尝试使用Django-Social-Auth登录Facebook但是我收到此错误:
TypeError at /complete/facebook/
datetime.datetime(2014, 4, 25, 22, 20, 14, 665216, tzinfo=<UTC>) is not JSON serializable
Run Code Online (Sandbox Code Playgroud)
这是我的登录模板:
<a href="{% url 'socialauth_begin' 'facebook' %}">Login with FB</a>
Run Code Online (Sandbox Code Playgroud)
我的设置:
SOCIAL_AUTH_DEFAULT_USERNAME = 'new_social_auth_user'
SOCIAL_AUTH_UID_LENGTH = 16
SOCIAL_AUTH_ASSOCIATION_HANDLE_LENGTH = 16
SOCIAL_AUTH_NONCE_SERVER_URL_LENGTH = 16
SOCIAL_AUTH_ASSOCIATION_SERVER_URL_LENGTH = 16
SOCIAL_AUTH_ASSOCIATION_HANDLE_LENGTH = 16
SOCIAL_AUTH_ENABLED_BACKENDS = ('facebook')
Run Code Online (Sandbox Code Playgroud) 我正在尝试在Ubuntu 14.04中安装Rattle,但我收到此错误:
Error in loadNamespace(name) : there is no package called ‘RGtk2’
Run Code Online (Sandbox Code Playgroud)
但是当我尝试安装RGtk2时,我得到了这个:
configure: error: GTK version 2.8.0 required
ERROR: configuration failed for package ‘RGtk2’
Run Code Online (Sandbox Code Playgroud)
当我尝试安装libgtk2.0-dev时
同
sudo apt-get install libgtk2.0-dev
Run Code Online (Sandbox Code Playgroud)
我明白了:
The following packages have unmet dependencies:
libgtk2.0-dev : Depends: libgtk2.0-0 (= 2.24.23-0ubuntu1) but 2.24.23-0ubuntu1.1 is to be installed
Depends: libglib2.0-dev (>= 2.27.3) but it is not going to be installed
Depends: libgdk-pixbuf2.0-dev (>= 2.21.0) but it is not going to be installed
Depends: libpango1.0-dev (>= 1.20) but it …
Run Code Online (Sandbox Code Playgroud) 我试图用sequelize在paralel中运行2个promise,然后在.ejs模板中渲染结果,但是我收到了这个错误:
Promise.all(...).spread is not a function
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
var environment_hash = req.session.passport.user.environment_hash;
var Template = require('../models/index').Template;
var List = require('../models/index').List;
var values = {
where: { environment_hash: environment_hash,
is_deleted: 0
}
};
template = Template.findAll(values);
list = List.findAll(values);
Promise.all([template,list]).spread(function(templates,lists) {
res.render('campaign/create.ejs', {
templates: templates,
lists: lists
});
});
Run Code Online (Sandbox Code Playgroud)
我怎么解决这个问题?
我收到这个错误:
Unhandled rejection SequelizeUniqueConstraintError: Validation error
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?
这是我的models/user.js
"use strict";
module.exports = function(sequelize, DataTypes) {
var User = sequelize.define("User", {
id: { type: DataTypes.INTEGER, autoIncrement: true, primaryKey: true},
name: DataTypes.STRING,
environment_hash: DataTypes.STRING
}, {
tableName: 'users',
underscored: false,
timestamps: false
}
);
return User;
};
Run Code Online (Sandbox Code Playgroud)
这是我的routes.js:
app.post('/signup', function(request, response){
console.log(request.body.email);
console.log(request.body.password);
User
.find({ where: { name: request.body.email } })
.then(function(err, user) {
if (!user) {
console.log('No user has been found.');
User.create({ name: request.body.email }).then(function(user) {
// you can now access …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 SQLAlchemy Migrate 迁移表,但出现此错误:
sqlalchemy.exc.UnboundExecutionError: Table object 'responsibles' is not bound to an Engine or Connection. Execution can not proceed without a database to execute against.
Run Code Online (Sandbox Code Playgroud)
当我运行时:
python manage.py test
Run Code Online (Sandbox Code Playgroud)
这是我的迁移文件:
from sqlalchemy import *
from migrate import *
meta = MetaData()
responsibles = Table(
'responsibles', meta,
Column('id', Integer, primary_key=True),
Column('breakdown_type', String(255)),
Column('breakdown_name', String(500)),
Column('email', String(255)),
Column('name', String(255)),
)
def upgrade(migrate_engine):
# Upgrade operations go here. Don't create your own engine; bind
# migrate_engine to your metadata
responsibles.create()
def downgrade(migrate_engine): …
Run Code Online (Sandbox Code Playgroud) javascript ×3
python ×3
django ×2
node.js ×2
sequelize.js ×2
ubuntu ×2
amazon-ec2 ×1
google-oauth ×1
mysql ×1
oauth-2.0 ×1
php ×1
promise ×1
r ×1
sqlalchemy ×1