草庐IT

mod_dav_auth

全部标签

python - Django 无法从 django.contrib.auth.views 导入登录信息

我尝试为我的页面构建一个登录功能。要按如下方式编辑urls.py,它会不断打印:cannotimportname'login'from'django.contrib.auth.views'我该如何处理这个问题?fromdjango.contrib.auth.viewsimportloginfromdjango.urlsimportpathfrom.importviewsapp_name="users"urlpatterns=[path("login/",login,{"template_name":"users/login.html"},name="login"),]

python - 如何使用 Django Social Auth 连接 Twitter?

我正在尝试使用DjangoSocialAuth包连接到Twitter,但我很难理解如何做到这一点,因为我找不到任何例子。我假设DjangoSocialAuth是用于此目的的最佳包。我查看了一些使用Facebook的示例,并将以下内容添加到我的settings.py文件中:AUTHENTICATION_BACKENDS=('social_auth.backends.twitter.TwitterBackend','django.contrib.auth.backends.ModelBackend',)#overwritingdefaulttemplatesTEMPLATE_CONTEXT

python - 使用python-social-auth的django社交身份验证错误

我正在关注这个answer这非常清楚和有帮助,我已经配置了所有设置,但是在使用gmail登录后,我被重定向到localhost:8000/soc/complete/google-oauth2/?state=jAwzw....我收到这个错误HTTPErrorat/soc/complete/google-oauth2/403ClientError:Forbiddenforurl:https://www.googleapis.com/plus/v1/people/me?access_token=ya29..wwKoNcTfjGshqc8UYfdziBbgVtYP4bgBZ9ehrfsHJjf

php - mod_cgi、mod_fastcgi、mod_scgi、mod_wsgi、mod_python、FLUP。我不知道还有多少。什么是 mod_php 等价物?

我最近学习了Python。我喜欢它。我只是想将它用于网络开发。这个想法造成了所有的麻烦。但我喜欢这些麻烦:)来自只有一种标准化方法的PHP世界。我期望相同并搜索python和apache。SettingupPythononWindows/Apache?说Stayawayfrommod_python.Onecommonmisleadingideaisthatmod_pythonislikemod_php,butforpython.Thatisnottrue.那么python中的mod_php相当于什么?关于这个我几乎不需要澄清HowPythonwebframeworks,WSGIandC

python - 使用 Django auth 用户模型作为外键和反向关系

我正在使用django.contrib.auth.models中的User模型。我有另一个名为Post的模型,它通过外键引用User。问题是当我尝试通过访问登录用户的帖子时request.user.post_set.order_by('-timestamp')我得到一个错误,User对象没有属性post_set。那么如何使用带外键的默认身份验证模型呢? 最佳答案 您是否在settings.py安装的应用程序中包含了包含Post模型的应用程序?例如INSTALLED_APPS=('django.contrib.auth','djang

python - Django : Case insensitive matching of username from auth user?

默认情况下,Django将用户名实现为区分大小写,现在为了身份验证,我编写了自己的AuthenticationBackend以在身份验证时处理不区分大小写的用户名。如图:http://blog.shopfiber.com/?p=220现在,问题是:我有各种View和实用方法,可以将username与一些stings进行比较。即request.user.username==username_from_some_other_system_as_str现在,如果用户名是yugal那么:request.user.username=='Yugal'#ReturnsFalse现在,它应该返回Tru

python - Django 转储数据 django.contrib.auth

我想要转储django.contrib.auth应用程序的数据。我试过:>>pythonmanage.pydumpdatadjango.contrib.auth>'django.contrib.admin.json'Error:Unknownapplication:django.contrib.auth>>pythonmanage.pydumpdata'django.contrib.auth'>'django.contrib.admin.json'Error:Unknownapplication:django.contrib.auth没有任何作用。需要你的帮助。

python - Django + mod_wsgi + apache : ImportError at/No module named djproj. 网址

我正在尝试使用apache和mod_wsgi在我的linode服务器上部署我的Django应用程序。文件:/srv/www/example.com/djproj/django.wsgiimportosimportsyssys.path.append('/srv/www/example.com/djproj')os.environ['PYTHON_EGG_CACHE']='/srv/www/example.com/.python-egg'os.environ['DJANGO_SETTINGS_MODULE']='settings'importdjango.core.handlers.ws

python - 无法解决 Django 设置中的 mod_wsgi 异常

我正在与我的托管服务提供商合作来启动和运行Django应用程序,但我们都不是很有经验,我们基本上已经走到了死胡同。我没有直接访问conf文件的权限,但这是我对它的内容的描述:WSGIScriptAlias/fredapp//home/fred/public_html/cgi-bin/fredapp/apache/django.wsgiWSGIDaemonProcessfredthreads=15display-name=%{GROUP}python-path=/home/fred/public_html/cgi-bin/fredapp/apache/WSGIProcessGroupfr

python - Apache mod_wsgi 错误 : Forbidden You don't have permission to access/on this server

我正在使用Ubuntu10.04。我在/home/wong2/Code/python/django2/下创建了一个名为atest的django项目并在同一目录下创建一个wsgi文件setting.wsgi以下是setting.wsgi的内容:importosimportsyspath='/home/wong2/Code/python/django2'ifpathnotinsys.path:sys.path.append(path)os.environ["DJANGO_SETTINGS_MODULE"]="atest.settings"fromdjango.core.handlers.w