小编jln*_*ais的帖子

Django Rest Framework自定义身份验证

http://www.django-rest-framework.org/api-guide/authentication/#custom-authentication

我想在我的django应用程序中使用自定义身份验证,但无法找到如何应用它.任何人都可以帮我这个.我在文档中给出的示例很清楚,但他们没有提到创建这个新类的位置以及如何使用它.

提前致谢!

python authentication django rest django-rest-framework

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

使用 pip 安装 kivy 时出错 - Python

我正在尝试使用 pip 安装 kivy,但出现错误:

c:\***\temp\pip-build-7e9b8p\kivy\kivy\graphics\gl_redirect.h(8) : fatal error C1083: Cannot open include file: 'GL/glew.h': No such file or directory
     error: command 'C:\\***\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2
Run Code Online (Sandbox Code Playgroud)

有什么建议吗?

python pip failed-installation kivy

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

Django教程 - 查看详细信息时的轮询错误404

我正在关注https://docs.djangoproject.com/en/1.8/intro/tutorial03/ 我已经按照教程中的方式配置了我的项目目录.我正在为民意调查配置网址.根据教程我定义了详细信息,结果,在投票的urls.py中的views.py和poll url中投票,这是在项目目录的urls.py中定义的.当我访问

本地主机:8000 /调查/

有用.但是,当我试图访问一个民意调查的细节,因为他们描述它抛出404.I我尝试了我的实际问题ID,但都是徒劳的.
在Docs中他们说"at"/ polls/34 /".它将运行detail()方法"但对我来说它会抛出404

本地主机:8000 /调查/ 34 /

Using the URLconf defined in DjangoFirst.urls, Django tried these URL patterns, in this order:
^polls ^$ [name='index']
^polls ^(?P<question_id>[0-9]+)/$ [name='detail']
^polls ^(?P<question_id>[0-9]+)/results/$ [name='results']
^polls ^(?P<question_id>[0-9]+)/votes/$ [name='vote']
^admin/
The current URL, polls/34/, didn't match any of these.
Run Code Online (Sandbox Code Playgroud)

这是位于ProjectName/ProjectName/urls.py中的urls.py

from django.conf.urls import include, url
from django.contrib import admin

urlpatterns = [
    url (r'^polls', include('polls.urls')),
    url(r'^admin/', include(admin.site.urls)),

]
Run Code Online (Sandbox Code Playgroud)

这是我的民意调查urls.py位于ProjectName/polls/urls.py中

from django.conf.urls import url

from . import views

urlpatterns = …
Run Code Online (Sandbox Code Playgroud)

python django django-urls

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