所以关于ldap和Django的所有教程都是从开头说的
import ldap
from django_auth_ldap.config import LDAPSearch
Run Code Online (Sandbox Code Playgroud)
但无论我得到什么错误:
ImportError: Could not import settings 'reportgenerator.settings' (Is it on sys.path?
Is there an import error in the settings file?): No module named
django_auth_ldap.config
Run Code Online (Sandbox Code Playgroud)
我错过了什么吗?我安装了python-ldap.
通过在命令行上运行以下命令解决了这个问题:
pip install django-auth-ldap
Run Code Online (Sandbox Code Playgroud) 我有一个UIView,用以下绘制:
- (void)drawRect:(CGRect)rect
{
UIBezierPath *bezierPath = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, self.widthOfLine, self.heightOfLine)];
[bezierPath fill];
}
Run Code Online (Sandbox Code Playgroud)
并且其框架在iOS窗口中居中.我想在这个视图中随机放置一堆较小的(5px乘5px)视图,我可以使用arc4random()函数并绘制视图.但是,我似乎无法弄清楚如何切断bezierPathWithOvalInRect之外的所有视图,它只会在第一个UIView框架中的任何位置显示它们.谁知道该怎么做?
编辑:
为清楚起见,我将另一个视图定义为:
- (void)drawRect:(CGRect)rect
{
UIBezierPath *drawPath = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(self.xPosition, self.yPosition, self.width, self.width)];
[[UIColor whiteColor] setFill];
[drawPath fill];
}
Run Code Online (Sandbox Code Playgroud)
我将大量这些作为子视图添加到第一个视图中,但我希望它们不会显示在椭圆贝塞尔路径之外.有没有办法a)只在椭圆贝塞尔路径中添加它们而不是在整个框架内,或者b)从视图中剪切椭圆形外部的所有内容的方法?