开发者

How do I specify a custom registration app instead of an installed one in Django?

So I created my site that uses django-registration-0.8, but the server hosting it is using 0.7 installed server wide. I don't have access as to how the modules are being looked up, so I tried downloading the 0.8 source and placed the registration/ folder and registered it in settings.py (INSTALLED_APPS) as registration.

Now the custom registration app (0.8) is being seen by django. However, when trying to access the register page I get this error:

ImportError at /accounts/register/
No module named backends.default.urls

Which is called in urls.py as:

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

If I change it to

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

the error is gone, but that means it's using the installed (0.7) version. One of the problems with that version is the activation page being different.

Checking the registration app folder I can see the module exists, in registration/backends/default/urls. So my conclusion is that the registration installed server-wide (0.7) is the one being looked into first before the one I manually extracted from source (0.8).

So my question is how do I make Django look up the 0.8 version I install开发者_如何学Ced as an app, instead of the one installed server-wide? I don't have access to shell (using djangofoo hosting), only manage.py and ftp.


Can you confirm the version being found? Without direct shell access, you might be able to create a management command to print out the registration.get_version() method.

You could try adding the directory the custom registration app is in to the front of the pythonpath using sys.path.insert(0,[path]).

You could also try renaming the custom registration app (registration2?) to make sure you're seeing it on the pythonpath and importing the right one.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜