0

I just installed django-userena for my accounts management.

Because I'm still at the stage of basic development and I don't have a public domain name. I'm using gmail for my EMAIL_HOST for testing. The default setting from django-userena is using example.com for demo. How can I switch it to my local domain, i.e. 127.0.0.1:8000, so I can make some dummy "users" activated and test it for my other apps?

Thank you!!!

EDITED: Because I don't have a domain name, when the user click the activation email in his email(e.g. Gmail), it's directed to http://example.com/accounts/activate/hash_as_placeholder/, so the result is that the user can't activate his account. How can I let them activate their accounts on a local domain?

user2988464
  • 3,251
  • 6
  • 21
  • 25

1 Answers1

1

Try this. Add this lines to settings.py

LOGIN_REDIRECT_URL = '/accounts/%(username)s/'  
LOGIN_URL = '/accounts/signin/'  
LOGOUT_URL = '/accounts/signout/'  

and about email configuration, i have issues with gmail if i send a lot of mails. So for testing purposes i have this in my settings:

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' #printed in console

All emails will be printed in console.

EDITED: Create new file initial_data.json in your project root with

[{
"pk": 1,
"model": "sites.site",
"fields": {
   "name": "127.0.0.1:8000",
   "domain":"127.0.0.1:8000"
   }
}]

and run syncdb of course. This will change your example.com to 127.0.0.1:8000

juree
  • 253
  • 2
  • 12
  • after that how can i activate the user's account? – user2988464 May 24 '14 at 17:55
  • i can see the email printed in the console, but when i try to login with the newly signuped account, the browser still show "Your account has been disabled". How can I use the printed email for activation on my local computer? – user2988464 May 24 '14 at 18:27
  • I see..Check answer again – juree May 24 '14 at 18:30
  • if I set `EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'` , no email will be sent, the email is just printed in console. if I set `EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'` , an email is sent from gmail, in which the link is still 'example.com' even i set the `initial_data.json` in the directory with manage.py – user2988464 May 24 '14 at 18:40
  • Move it in same folder that settings.py. And then run syncdb – juree May 24 '14 at 18:42
  • because I use South instead, I migrated all the apps. But i still can't activate the user's account, ant get this in my console: `lib/python2.7/site-packages/userena/views.py:388: DeprecationWarning: The use of AUTH_PROFILE_MODULE to define user profiles has been deprecated. extra_context['profile'] = user.get_profile()` – user2988464 May 24 '14 at 18:50
  • Run syncdb. I tried in one app which is South used, and i syncdb works. And move in the same folder that settings.py is. For error you provide, check this [link](http://stackoverflow.com/questions/20613315/get-rid-of-get-profile-in-a-migration-to-django-1-6) – juree May 24 '14 at 18:54
  • Or you can change or add sites in your Admin page. Read [here](http://django-userena.readthedocs.org/en/latest/installation.html#required-settings) on bottom, for more informations. – juree May 24 '14 at 19:01
  • after i put the `initial_data.json` in the directory with `settings.py`, it works!!! Thank you!! – user2988464 May 24 '14 at 19:07