views:

182

answers:

2

Hi. Previously I've been using some older version of django-registration which seems to be deprecated now. Because my server does not allow me to install python plugins I need to use 'registration' as separate django application. Now my question is what do I need to modify in order to get registation running as django-app ? Can I just copy 'registration' to my django project catalog, add it in settings and it should work ? Previously there was no such thing as 'backend' defined, now backend init file with function get_backend, that takes 'path' as argument. I guess this path is sent via url right ?

       url(r'^activate/(?P<activation_key>\w+)/$',
           activate,
           {'backend': 'registration.backends.default.DefaultBackend'},
           name='registration_activate'),

Inside this catalog there's also init file with DefaultBackend class, with classes activate and register.

http://paste.pocoo.org/show/225790/

They both use signals. Do I need to bother with those signals in any way ? (I still don't quite get what they're used for). Last thing. Previously after registration it was redirecting te either given success_url or set template in this way :

return HttpResponseRedirect(success_url or reverse('registration_complete'))

Now code responsible for this looks :

        if success_url is None:
            to, args, kwargs = backend.post_registration_redirect(request, new_user)
            return redirect(to, *args, **kwargs)
        else:
            return redirect(success_url)

and the post_registration_redirect :

def post_registration_redirect(self, request, user):
    """
    Return the name of the URL to redirect to after successful
    user registration.

    """
    return ('registration_complete', (), {})

So why was this changed in this way if it still simply redirect to 'registration_complete' ? The args and kwargs are empty so why bother ?

+1  A: 

The situation is much simpler than you're making it out to be. Django applications (like registration) are just normal Python packages and can be imported as such. What that means is that registration can live anywhere that's in your python path already. Oftentimes the simplest place for that is in your root project directory.

The backend argument there just takes a python import path. The argument was added so that people could extend Django-Registration to use custom backends if they so desire.

If you put the registration directory on your python path the existing string should work just fine.

Gabriel Hurley
great. I know that normally I can omit the install part. I was just wondering if in this situation I can or cannot (because of some modifications in 'backend' section) do the same. Thanks
owca
A: 

Quote:

"Because my server does not allow me to install python plugins I need to 
 use 'registration' as separate django application."

Is this because you don't have root access? Have you tried using virtualenv to create your own (fully writeable) Python/Django install? Alternatively, creating a writeable directory in a place you do have write access, installing django-registration there and pointing your PYTHON_PATH to that location?

IMO, it seems like you gave up too quickly on the "install django-registration" option and moved to the more complicated "run it on a different server" one.

mitchf