小编Avi*_*eir的帖子

用户脚本与Chrome扩展程序

我正在开发一个扩展,它将读取HTML元素值,然后对外部网站进行API调用,获取结果并将其显示在新创建的HTML元素中.

在本机chrome扩展与用户脚本中编写它的优点/缺点是什么?

userscripts google-chrome-extension tampermonkey

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

使用 Heroku/gunicorn/django 配置部署的问题

我正在尝试在 heroku 上运行我的 django 应用程序。

文件夹结构:

app/
  Procfile
  docs/
  ...
  project/
    manage.py
    wsgi.py
    <django apps>
Run Code Online (Sandbox Code Playgroud)

配置文件

web: gunicorn --pythonpath="$PWD/project" wsgi:application --log-file=-
Run Code Online (Sandbox Code Playgroud)

我得到的错误:

2015-02-16T16:05:00.646316+00:00 heroku[web.1]: Starting process with command `gunicorn --pythonpath="$PWD/project" wsgi:application --log-file=-`
2015-02-16T16:05:02.697633+00:00 app[web.1]: [2015-02-16 16:05:02 +0000] [3] [INFO] Listening at: http://0.0.0.0:44846 (3)
2015-02-16T16:05:02.709567+00:00 app[web.1]: [2015-02-16 16:05:02 +0000] [9] [INFO] Booting worker with pid: 9
2015-02-16T16:05:02.696968+00:00 app[web.1]: [2015-02-16 16:05:02 +0000] [3] [INFO] Starting gunicorn 19.1.1
2015-02-16T16:05:02.697790+00:00 app[web.1]: [2015-02-16 16:05:02 +0000] [3] [INFO] Using worker: sync
2015-02-16T16:05:02.793753+00:00 app[web.1]: [2015-02-16 16:05:02 +0000] …
Run Code Online (Sandbox Code Playgroud)

deployment django wsgi heroku django-wsgi

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

Heroku上的Django Celery任务导致高内存使用率

我在Heroku上有一个celery任务,它连接到一个外部API并检索一些数据,存储在数据库中并重复几百次.非常快(在~10次循环之后)Heroku开始警告高内存使用率.有任何想法吗?

tasks.py

@app.task
def retrieve_details():
    for p in PObj.objects.filter(some_condition=True):
        p.fetch()
Run Code Online (Sandbox Code Playgroud)

models.py

def fetch(self):
    v_data = self.service.getV(**dict(
        Number=self.v.number
    ))
    response = self.map_response(v_data)

    for key in ["some_key","some_other_key",]:
        setattr(self.v, key, response.get(key))

    self.v.save()
Run Code Online (Sandbox Code Playgroud)

Heroky记录

2017-01-01 10:26:25.634
132 <45>1 2017-01-01T10:26:25.457411+00:00 heroku run.5891 - - Error R14 (Memory quota exceeded)

Go to the log: https://api.heroku.com/myapps/xxx@heroku.com/addons/logentries

You are receiving this email because your Logentries alarm "Memory quota exceeded"
has been triggered.

In context:
2017-01-01 10:26:25.568 131 <45>1 2017-01-01T10:26:25.457354+00:00 heroku run.5891 - - Process running mem=595M(116.2%)
2017-01-01 10:26:25.634 …
Run Code Online (Sandbox Code Playgroud)

python django heroku django-celery

9
推荐指数
2
解决办法
833
查看次数

MongoDB 连接是否可能在 Python 中超时?

(新手问题,抱歉 - 我刚刚开始使用 MongoDB)

我正在像这样连接到 heroku 上的 mongo:

self.connection = pymongo.Connection(MONGO_URL)
self.db = self.connection.app13805318
Run Code Online (Sandbox Code Playgroud)

是否有可能我在几个小时后尝试使用 self.db 并且无法读取它?我是否需要对连接进行某种保活或刷新?

python heroku mongodb

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

邀请用户 django-allauth

我想介绍一个流程,我们已经在使用 allauth 并想尝试使其与 allauth 一起使用(可能会添加另一个包):

  1. 通过指定他的电子邮件邀请新用户(仅。不需要密码)
  2. 用户收到一封电子邮件,点击邀请链接并进入一个已经填写了他的电子邮件的表单,他需要填写更多字段,例如密码、名字和姓氏以及一些我将添加到的自定义字段用户模型
  3. 用户点击确认并登录,重定向到根 URL

django django-allauth

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

AWS权限被拒绝(公钥)

我正在尝试连接到我的EC2实例并收到以下错误.

命令我正在运行:ssh -v -i key.pem ubuntu @ [我的实例地址]

正如我在其他线程中看到的那样,我将密钥文件的权限更改为600,但这并没有解决问题.

输出我得到:

OpenSSH_5.9p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to ec2-54-247-2-128.eu-west-1.compute.amazonaws.com [54.247.2.128] port 22.
debug1: Connection established.
debug1: identity file /Users/avimeir/.ssh/id_rsa type 1
debug1: identity file /Users/avimeir/.ssh/id_rsa-cert type -1
debug1: identity file /Users/avimeir/.ssh/id_dsa type -1
debug1: identity file /Users/avimeir/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1 pat OpenSSH*
debug1: …
Run Code Online (Sandbox Code Playgroud)

amazon-ec2 amazon-web-services

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