小编Tms*_*s91的帖子

H1,H2,H3标题中的粗体字体-92590

我需要帮助找出如何在WordPress的典雅主题中获得粗体字体,但仅限于标题区域(h1,h2,h3等),因为在文本正文中获取它没有问题。

我已经尝试过,即使在编辑器中我的标题变得粗体,无论我进行了什么更改,发布页面后都不会出现这种情况。

我包括了代码(不是完整的,而是重要的部分)-一旦发布,“ h1”区域中的任何更改都不会反映出来,字体大小也不会反映出来。我不是编码员,所以也许我缺少一些东西。请帮忙:

/*------------------------------------------------*/

/* http://meyerweb.com/eric/tools/css/reset/ */
/* v1.0 | 20080212 */

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend { margin: 0; padding: 0; border: 0; outline: 0; font-size: 100%; vertical-align: baseline; …
Run Code Online (Sandbox Code Playgroud)

css wordpress wordpress-theming

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

PyQuery如何将元素追加并重命名为每个子元素

如何将类的属性附加或插入其子元素,但仅针对直接子元素,然后重复下一个类和子元素.

在文档中,这里引用了pyquery操作

>>> d = pq('<html><body><div id="test"><a href="http://python.org">python</a> !</div></body></html>') >>> p.prependTo(d('#test')) [<p#hello.hello>] >>> d('#test').html() u'<p class="hello" ..
Run Code Online (Sandbox Code Playgroud)

样品

<meeting id="42499" barriertrial="0" venue="Royal Randwick" date="2016-04-09T00:00:00" gearchanges="-1" stewardsreport="-1" gearlist="-1" racebook="0" postracestewards="0" meetingtype="TAB" rail="Timing - Electronic : Rail - +6m 1600-wp +3m Rem" weather="Fine      " trackcondition="Soft 6    " nomsdeadline="2016-04-04T11:00:00" weightsdeadline="2016-04-05T16:00:00" acceptdeadline="2016-04-06T09:00:00" jockeydeadline="2016-04-06T12:00:00">
  <club abbrevname="Australian Turf Club" code="56398" associationclass="1" website="http://" />
  <race id="211911" number="1" nomnumber="10" division="0" name="TFE HOTELS FERNHILL HANDICAP" mediumname="FERNHILL" shortname="FERNHILL HCP" stage="Results" distance="1600" minweight="0" raisedweight="0" class="~         " age="2         " grade="0" weightcondition="QLT …
Run Code Online (Sandbox Code Playgroud)

python xml-parsing pyquery

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

Django 中的搜索栏

编辑:我设法使用“DjangoFilter”包含一个搜索栏

我想在 Django 的模板中添加一个搜索栏

我想在文章列表上方包含一个搜索框,以便用户可以搜索数据。

当我在栏中输入某些内容时,什么也没有发生......
在我的代码下方

感谢您提前在 HTML 页面中的帮助

    <form class="form-inline my-2 my-lg-0">
    <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search" name="search" >
    <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
    </form>
Run Code Online (Sandbox Code Playgroud)

在views.py中

def article_overview(request):
    search_term = ''

    if 'search' in request.GET:
        search_term = request.GET['search']
        articles = Article.objects.all().filter(feeder__icontains=search_term) 

    articles = Article.objects.all()

    return render(request, 'overviews/overview.html', {'articles' : articles, 'search_term': search_term })    
Run Code Online (Sandbox Code Playgroud)

在overview.html(简化)中:

{% for article in articles %}
<a> {{article.feeder}} </a> 
{% endfor %}
Run Code Online (Sandbox Code Playgroud)

django

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

如何在django中从imagefield显示图像到模板

我的模板无法显示来自我的模型的图像。

src 属性带有正确的字段,但它不显示正确的图像

模板:

       <div class="grid-product">
  
    {% for p in prod %}
    
    
    <div class="  product-grid">
        <div class="content_box"><a href="single.html">
        <div class="left-grid-view grid-view-left">
             <img  class="img-responsive watch-right" alt="not found" src="{{p.photo}}"/>
                <div class="mask">
                    <div class="info">Quick View</div>
                </div>
              </a>
        </div>
            <h4><a href="#"></a></h4>
             <p>It is a long established fact that a reader{{ p.p_name }}</p>
             Rs. 499
        </div>
   </div>
    {% endfor %} 
         <div id="show"></div>
    <div class="clearfix"> </div>
</div>
Run Code Online (Sandbox Code Playgroud)

模型:

class product(models.Model):
    p_id=models.AutoField(primary_key=True)
    ps_id=models.ForeignKey(alphasubcat,on_delete=models.CASCADE)
    p_name=models.CharField(max_length=100,null=True,blank=True)
    photo = models.ImageField(upload_to='productimage',blank=True)
    price=models.IntegerField()
    def __str__(self):
        return self.p_name
Run Code Online (Sandbox Code Playgroud)

看法:

def produc(request):
    param=dict()
    cat=categories.objects.all() …
Run Code Online (Sandbox Code Playgroud)

django python-3.x

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

无法使用 Python 2.7、Windows 在 Git Bash 上创建和激活虚拟环境

我在 Windows 上使用 Git Bash 和 python 2.7,并且我想在虚拟环境中工作。

当我打字时

virtualenv venv
Run Code Online (Sandbox Code Playgroud)

重击 说

bash:virtualenv:找不到命令

这让我认为 virtualenv 没有安装,然后我尝试安装 virtualenv

pip install virtualenv
Run Code Online (Sandbox Code Playgroud)

但巴什再次说

bash:pip:找不到命令

然后通过阅读此线程python 2.7:cannotpiponwindows"bash:pip:commandnotfound"我发现它找不到 pip 目录,这可能与它找不到 virtualenv 目录的原因相同。所以我指定了pip的路径,然后再次尝试安装virtualenv

python -m pip install virtualenv
Run Code Online (Sandbox Code Playgroud)

它安装 virtualenv 但然后告诉

弃用:Python 2.7 将于 2020 年 1 月 1 日结束其生命周期。请升级您的 Python,因为该日期之后将不再维护 Python 2.7。pip 的未来版本将放弃对 Python 2.7 的支持。

所以我继续尝试通过输入激活我的 virtualenv

virtualenv venv
Run Code Online (Sandbox Code Playgroud)

正如我所料,我得到了与之前相同的错误

bash:virtualenv:找不到命令

我尝试以与 pip 相同的方式解决这个问题,方法是输入

python -m virtualenv venv
Run Code Online (Sandbox Code Playgroud)

这次 bash 响应为

$ python -m virtualenv venv C:\Users\Tommaso\DJANGO~1\UDEMYD~1\METAGL~2\venv\Scripts\python.exe 中的新 python 可执行文件安装 …

windows pip virtualenv python-2.7 git-bash

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

Docker 证书已过期或尚未生效

我刚刚第一次安装 docker,当默认的 virtualbox 或“docker-machine”(不确定它叫什么)时,我遇到了这个错误:

这是摘录

Checking connection to Docker...
Error creating machine: Error checking the host: Error checking and/or regenerat
ing the certs: There was an error validating certificates for host "192.168.99.1
01:2376": x509: certificate has expired or is not yet valid
You can attempt to regenerate them using 'docker-machine regenerate-certs [name]
'.
Be advised that this will trigger a Docker daemon restart which might stop runni
ng containers.
Run Code Online (Sandbox Code Playgroud)

我尝试使用该docker-machine regenerate-certs [name]命令,它似乎工作至少没有引发任何错误。只有当我尝试运行 docker 的 hello world 命令时,这才是我得到的结果。

docker: …
Run Code Online (Sandbox Code Playgroud)

docker docker-machine

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

Docker:为什么 --rm 在我退出容器时不删除它

我在 Windows10 上运行 Docker。

\n

将 --rm 添加到 docker 容器运行命令应该会在我退出容器时删除我的容器,但从一段时间以来,如果我输入

\n
docker container run -p 80:80 --rm nginx\n
Run Code Online (Sandbox Code Playgroud)\n

我明白了

\n
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration\n/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/\n/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh\n10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf\n10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf\n/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh\n/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh\n/docker-entrypoint.sh: Configuration complete; ready for start up\n
Run Code Online (Sandbox Code Playgroud)\n

nginx 在我的 docker-machine IP 地址上运行良好,但是如果我输入

\n
ctrl+C\n
Run Code Online (Sandbox Code Playgroud)\n

我检查我的容器,docker container ls发现容器仍在运行:

\n
$ docker container …
Run Code Online (Sandbox Code Playgroud)

docker

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

如果类没有参数,如何将参数传递给类?

我可能缺乏非常基本的Python基础。我正在处理别人制作的脚本。

我有一个脚本,比方说My_Class,其中的代码是:

import thing1
import thing_2
...etc

class My_Class:

    def __init__(self, arg1, arg2 ...etc):
        self.argument_1 = arg1
        self.argument_2 = arg2
        ...etc
Run Code Online (Sandbox Code Playgroud)

__init__my_class 的参数未作为参数传递给 my_class是否正确?(my_class 根本没有参数)

如果类没有参数,如何arg1, arg2 ...etc传递参数?my_class

难道不应该吗

import thing1
import thing_2
...etc

class My_Class(arg1, arg2 ...etc):

    def __init__(self, arg1, arg2 ...etc):
        self.argument_1 = arg1
        self.argument_2 = arg2
        ...etc
Run Code Online (Sandbox Code Playgroud)

反而?

笔记:

该类不会被实例化,仅直接在该类上调用其方法,即:

My_Class(arg1, arg2 ...etc).method_1()
Run Code Online (Sandbox Code Playgroud)

python oop class init

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