我有以下内容:
我在命令行输入了ipcluster:
ipcluster nbextension enable
Run Code Online (Sandbox Code Playgroud)
我正在尝试在Jupyter笔记本上的IPython Clusters选项卡上创建一个新集群,但这就是我所看到的:
我之前能做到这一点.谢谢!
我有Django应用程序.它在EC2上运行.EC2具有私有IP地址和弹性公共IP地址.
我希望Web应用程序在本地可用,以及Developer's IP地址在网络外部.
让我们将这三个IP地址定义为:
EC2_PRIVATE_IP
EC2_PUBLIC_IP
DEVELOPER_IP
Run Code Online (Sandbox Code Playgroud)
所以我做的是在EC2上运行:
python manage.py runserver 0.0.0.0:8000
Run Code Online (Sandbox Code Playgroud)
进入我的EC2安全设置,打开入站和出站端口8000到DEVELOPER_IP.
然后要求Developer在他的浏览器上转到EC2_PUBLIC_IP地址.
不幸的是,这不起作用,因为他得到错误:
Gateway Timeout: can't connect to remote host
Run Code Online (Sandbox Code Playgroud)
我之前尝试过:
python manage.py runserver {EC2_PUBLIC_IP}:8000
Run Code Online (Sandbox Code Playgroud)
但是我得到了错误:
Error: That IP address can't be assigned-to.
Run Code Online (Sandbox Code Playgroud) 对于如何记住我与 Omniauth 的合作似乎有些混乱。
根据此wiki,您需要在 OmniauthCallbacksController 中包含以下内容:
remember_me(user)
Run Code Online (Sandbox Code Playgroud)
另一方面,根据这个问题,你只需要这样做:
user.remember_me = true
Run Code Online (Sandbox Code Playgroud)
另外,根据this使remember_me默认为true ,你只需要将以下内容添加到你的User.rb中
def remember_me
true
end
Run Code Online (Sandbox Code Playgroud)
不确定哪一个是官方答案,这三个都不适合我。它仅适用于 Mac 上的 Chrome,但不适用于 Firefox Mac 和 Chrome Windows。不知道发生了什么事。
我的代码如下所示:
# -*- encoding : utf-8 -*-
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
include Devise::Controllers::Rememberable
def all
omniauth = request.env["omniauth.auth"]
auth = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])
if auth
auth.update_with_omniauth omniauth
auth.save!
# ???
remember_me auth.user
auth.user.remember_me = true
if user_signed_in?
redirect_back_or settings_path(current_user)
else
sign_in_and_redirect auth.user, event: :authentication
end
else
if user_signed_in?
current_user.build_auth(omniauth).save! …
Run Code Online (Sandbox Code Playgroud) 这是我很困惑的事情......
import pandas as pd
# this works fine
df1 = pd.DataFrame(columns=['A','B'])
# but let's say I have this
df2 = pd.DataFrame([])
# this doesn't work!
df2.columns = ['A','B']
# ValueError: Length mismatch: Expected axis has 0 elements, new values have 2 elements
Run Code Online (Sandbox Code Playgroud)
为什么这不起作用?我可以做什么?做这样的事情的唯一方法是什么?
if len(df2.index) == 0:
df2 = pd.DataFrame(columns=['A','B'])
else:
df2.columns = ['A','B']
Run Code Online (Sandbox Code Playgroud)
必须有更优雅的方式。
感谢您的帮助!
有人问为什么要这样做:
df2 = pd.DataFrame([])
Run Code Online (Sandbox Code Playgroud)
原因是实际上我正在做这样的事情:
df2 = pd.DataFrame(data)
Run Code Online (Sandbox Code Playgroud)
...其中数据可能是空的列表列表,但在大多数情况下不是。所以是的,我可以这样做:
if len(data) > 0:
df2 = pd.DataFrame(data, columns=['A','B']) …
Run Code Online (Sandbox Code Playgroud) 我在设置monitrc文件时遇到了困难。我使用Capistrano在Amazon EC2上设置Monit,并使用本教程作为指导:
http://railscasts.com/episodes/375-monit
set daemon 30
set logfile /home/deployer/apps/example/shared/log/monit.log
set idfile /var/lib/monit/id
set statefile /var/lib/monit/state
set eventqueue
basedir /var/lib/monit/events
slots 100
set mailserver email-smtp.us-east-1.amazonaws.com port 587
username "amazon_username" password "amazon_password"
using TLSV1
with timeout 30 seconds
set alert alerts@example.com
set httpd port 2812
allow admin: "admin_password"
check system example_server
if loadavg(5min) > 2 for 2 cycles then alert
if memory > 95% for 2 cycles then alert
if cpu(user) > 75% for 2 cycles then alert
include /etc/monit/conf.d/*
Run Code Online (Sandbox Code Playgroud)
查看我的日志,出现以下错误:
Sendmail错误:554邮件被拒绝:电子邮件地址未验证。 …
我在这里关注博客文章.
我正在使用Windows机器,所以我无法按照确切的步骤操作.这就是我所做的:
安装了pytorctl
pip install git+https://github.com/aaronsw/pytorctl
Run Code Online (Sandbox Code Playgroud)安装Privoxy
尝试使用Tor命令行.我假设它是目录"Tor Browser\Browser\TorBrowser\Tor"中的exe文件
tor --hash-password *mypassword*
Run Code Online (Sandbox Code Playgroud)不幸的是,这个命令运行但没有响应.
如果有人有任何建议,我们将不胜感激.你认为这可能是防火墙问题吗?
amazon-ec2 ×2
amazon-ses ×1
capistrano ×1
console ×1
devise ×1
django ×1
monit ×1
omniauth ×1
pandas ×1
python ×1
remember-me ×1
tor ×1
windows ×1