No module named backends.default.urls

江枫思渺然 提交于 2019-12-29 06:41:11

问题


So I've installed django-registration through easy_install. I'm following a quick start guide and I'm trying to setup my urlConf, however it says module named backends.defauls.urls is not found. What might be the problem ?

import registration
(r'^accounts/', include('registration.backends.default.urls')),

回答1:


Is the registration module in your PYTHONPATH?




回答2:


(not my solution, but since it was hidden in a comment)

You need to use use include('registration.urls'),

instead of include('registration.backends.default.urls')




回答3:


I'd suggest always getting django-registration from Bitbucket: https://bitbucket.org/ubernostrum/django-registration/overview.

I had a similar problem where I installed django-registration using pip install and it wasn't giving me up-to-date code.




回答4:


I had the same problem. Apparently the server where I'm trying to upload the urls.py script has an older version, 0.7 I think.

My initial workaround was to put django-registration as an app (from the source) and include it in INSTALLED_APPS, with the registration folder right alongside my other apps.

Then the new problem was that the installed version is being looked up before the 'custom' app, especially on imports. For example, in views.py, we have an

from registration.backends import get_backend

which seems to be missing from the 0.7 version. So this raises an exception, but checking on the registration app the function is there in registration/backend/init.py.

This causes clashes between the custom registration app (0.8) and the one installed server-wide (0.7) that I can't seem to get around to.



来源:https://stackoverflow.com/questions/4259497/no-module-named-backends-default-urls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!