小编ynd*_*lok的帖子

如何让 VS Code 默认全屏打开?

是否有设置让 VS Code 默认以全屏模式打开?

visual-studio-code

20
推荐指数
3
解决办法
5348
查看次数

Fabric:我如何对fabfile进行单元测试?

在我上一个项目中,我们的fabfile失控了.虽然我们项目的其余部分经过了充分测试,但我们没有为fabfile编写单个测试.重构是可怕的,在我们运行命令之前,我们不相信结构命令会如何工作.

我正在开始一个新项目,我想确保我们的fabfile从一开始就经过充分测试.服从测试山羊有一篇很好的文章讨论一些可能的策略,但它有更多的问题而不是答案.使用fabtest是可能的,虽然它似乎已经死了.

有没有人成功测试过他们的fabfile?如果是这样,怎么样?

python django fabric

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

在详细路径上使用权限类

我怎样才能将权限类应用于详细路径?

class EventViewSet(viewsets.ModelViewSet):

    @detail_route(methods=['post'])
    def messages(self, request, pk=None):
        ### Check a permissions class.
        ...
Run Code Online (Sandbox Code Playgroud)

django django-rest-framework

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

Bootstrap模态由于定位导航条而变黑

当我的Bootstrap模态显示时,它看起来像是在黑色背景后面.单击屏幕上的任意位置会导致模态消失.

这个问题似乎是由我的导航栏定位造成的 - 删除position: absolute;position: relative;修复它.不幸的是,由于我需要在导航栏上使用z-index,我无法摆脱定位.

为什么导航栏的位置导致模态被遮挡?有没有办法让模态出现在背景前面,同时保持导航栏上的定位?

html css positioning twitter-bootstrap

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

如何在Vim中创建行号和文本之间的边框

我想在行号的右边和文本的左边有一条细的边框线.

vim terminal

6
推荐指数
2
解决办法
1015
查看次数

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

pytest-xdist:LookupError:setuptools-scm无法检测版本

安装时pytest-xdist,我收到此错误:

Collecting pytest-xdist>=1.15.0
  Downloading https://company.com/pypi/packages/dc/b2/a59db3ef996b93c3ef35dbbc33557a71ef67a6839d94a52c88eeb1086002/pytest-xdist-1.15.0.tar.gz (87kB)
    100% |????????????????????????????????| 92kB 70.2MB/s
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-vyEgO5/pytest-xdist/setup.py", line 37, in <module>
        'Programming Language :: Python :: 3',
      File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
        _setup_distribution = dist = klass(attrs)
      File "/home/company/package_name/env/local/lib/python2.7/site-packages/setuptools/dist.py", line 318, in __init__
        _Distribution.__init__(self, attrs)
      File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
        self.finalize_options()
      File "/home/company/package_name/env/local/lib/python2.7/site-packages/setuptools/dist.py", line 376, in finalize_options
        ep.load()(self, ep.name, value)
      File "build/bdist.linux-x86_64/egg/setuptools_scm/integration.py", line …
Run Code Online (Sandbox Code Playgroud)

python pytest xdist

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

检查多面体是否包含GeoDjango中的点

我有一个MultiPolygon字段,preferences.locations和一个Point字段rental.location.在查询是否包含租赁位置时preferences.locations,只有rental.locationpreferences.locationsMultiPolygon中的第一个多边形包含查询时,查询才会成功.

例如,使用以下几何:

point1 = (81.20141954209073, -129.891357421875)
point2 = (40.70875101828792, -73.93179774284363)

preferences.locations = MultiPolygon(
    Polygon(((81.14748070499664, -163.289794921875),

              point1, # contains the first point

              (81.14748070499664, -163.289794921875),
              (81.14748070499664, -163.289794921875),)),

    Polygon(((40.70718949655447, -73.98123621940613),

              point2, # contains the second point

              (40.683762276904055, -73.99702906608582),
              (40.70718949655447, -73.98123621940613),)),
)

rental1.location = Point(*point1)

rental2.location = Point(*point2)
Run Code Online (Sandbox Code Playgroud)

当查询以查看包含哪些租赁位置时preferences.locations,应返回两个租赁,仅返回第一个租赁.

>>> Rental.objects.filter(location__contained=preferences.locations)
[<Rental: Rental object>] # rental1
Run Code Online (Sandbox Code Playgroud)

如何成功检查哪些租赁位置包含preferences.locations(无论它们包含哪个Polygon).

gis postgis geodjango

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