سؤال

I'm making a simple django site, for which I'm using the django-registration extension. I should probably add that I have just copied the django-registration source to my project as if it was my own app - I'm doing the site with someone else and we have our django environments configured differently, but we share the site's code through svn - I didn't want each one of us to install django-registration separately.

In the root urls.py file I've got:

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

'backends' and 'default' are packages inside the registration app.

In Aptana, the code-checking error message states: "Undefined variable from import: backends" In my test server's debug mode the error is " 'module' object has no attribute 'backends' "

If I do from registration import backends and include(backends.default.urls), 'default' is not found.

It works when I do from registration.backends import default and include(default.urls) but I don't want to do it this way as I won't be able to quickly see what it links to...

Why doesn't the environment load packages properly? In the same file I use other URLconf include paths containing package names like include(django.contrib.admin) and there's no problem with those. Is it because I've copied the registration source instead of installing the app? If so, what's the proper way to do this that would offer the desired source code portability?

هل كانت مفيدة؟

المحلول

Try specifying the path of the registration urls as a string, rather than importing the registration module in your urls.py:

url(r'^accounts/',include('registration.backends.default.urls'),
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top