小编Pro*_*eno的帖子

Celery 未提供主机名。恢复默认“本地主机”

我的里面有这个/var/log/celery/w1.log

在此输入图像描述

我正在按照此处的Celery 步骤进行操作。

我的里面有这个celery.py

from __future__ import absolute_import, unicode_literals

import os

from celery import Celery

# Set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sample.settings')

app = Celery('sample2',
            broker='amqp://',
            include=['sample2.tasks'])

# Using a string here means the worker doesn't have to serialize
# the configuration object to child processes.
# - namespace='CELERY' means all celery-related configuration keys
#   should have a `CELERY_` prefix. 
app.config_from_object('django.conf:settings', namespace='CELERY')

if __name__ == '__main__':
    app.start()
Run Code Online (Sandbox Code Playgroud)

我能做什么来解决这个问题?提前致谢。

django celery

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

django 管理站点导航侧边栏搞砸了

我最近在我的项目中添加了一个包,然后做了一个pip freeze > requirements.txt。然后pip install -r requirements.txt我对我的本地做了,它添加了一个侧边栏。

在此处输入图片说明

我也pip install -r requirements.txt对服务器做了一个,它产生了不同的结果。它的侧边栏搞砸了。

在此处输入图片说明

我尝试通过执行此答案来删除侧边栏但它没有被删除。

.toggle-nav-sidebar {
    z-index: 20;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 23px;
    width: 23px;
    border: 0;
    border-right: 1px solid var(--hairline-color);
    background-color: var(--body-bg);
    cursor: pointer;
    font-size: 20px;
    color: var(--link-fg);
    padding: 0;
    display: none; /*added*/
}

#nav-sidebar {
    z-index: 15;
    flex: 0 0 275px;
    left: -276px;
    margin-left: -276px;
    border-top: 1px solid transparent;
    border-right: 1px solid var(--hairline-color);
    background-color: …
Run Code Online (Sandbox Code Playgroud)

css python django sidebar

5
推荐指数
2
解决办法
267
查看次数

Django raw sql %d for ID 不适用于整数参数

我的 Django 模型有这个原始 sql:

cursor.execute('SELECT crowdfunding_offering.offering_name FROM crowdfunding_offering WHERE crowdfunding_offering.id = %d ORDER BY crowdfunding_offering.id DESC LIMIT 1', (int(self.offering.id),))
Run Code Online (Sandbox Code Playgroud)

这是行不通的。我收到此错误:

Exception Value:    near "%": syntax error
Run Code Online (Sandbox Code Playgroud)

然后我尝试更改%d%s,然后才有效。我认为%d用于数字参数并且%s用于字符串,但为什么它不适用于%d

这是 id 显然是整数的表:

在此输入图像描述

sqlite django

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

标签 统计

django ×3

celery ×1

css ×1

python ×1

sidebar ×1

sqlite ×1