小编App*_*hon的帖子

线程中django的call_command问题

我想在Thread中执行django的call_method.这是示例代码:

import sys
sys.path.append("/my/django/project/path/")
import threading
import time 


# Import my django project configuration settings
from django.core.management import setup_environ
from mydjangoprojectname import settings
setup_environ(settings)

from django.core.management import call_command

class ServerStarter(threading.Thread):
    def __init__(self):
        super(ServerStarter, self).__init__()
        print "ServerStarter instance created"

    def run(self):
        print "Starting Django Server..."
        call_command("runserver", noreload=True)


if __name__ == '__main__':
    starter = ServerStarter()
    starter.start()

------------------------------
OutPut:
ServerStarter instance created
Starting Django Server...
ServerStarter instance created
Starting Django Server...
Validating models...
0 errors found
Django version 1.2.3, using settings 'mydjangoprojectname.settings'
Development …
Run Code Online (Sandbox Code Playgroud)

python django multithreading pyqt pyside

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

是否可以在带有qt样式表的QPushButton(或QToolButton)中的文本上方放置一个图标?

#editButton {
    background: url(:/icons/icons/tango/mods/32x32/pencil.png) top center no-repeat;
    height: 50px;
}
Run Code Online (Sandbox Code Playgroud)

我尝试了多种方法将文本放在我的图标下面,但总是出现在按钮的中间(垂直和水平).我知道我可以在代码中使用QToolButton来做到这一点,但我需要在应用程序样式表中这样做.

提前致谢!

user-interface qt stylesheet

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

标签 统计

django ×1

multithreading ×1

pyqt ×1

pyside ×1

python ×1

qt ×1

stylesheet ×1

user-interface ×1