Closed grwhumphries closed 5 years ago
Spirit has a ST_CASE_INSENSITIVE_EMAILS
setting, default is True
. So trying different casing won't work if that's what you're trying. Otherwise, the email must exists... are you sure it does not?
Yeah - I'm sure it doesn't exist. I've also been getting a "User has no st" error? Could the two be linked?
Could the two be linked?
No, I don't think so. I'll try to reproduce it, give a few minutes.
Spirit creates a user profile when a user is created. So, you'll have to create profiles for existing users. I think I can create the profile at log-in, if it does not exist :thinking:
Unrelated: set ST_CASE_INSENSITIVE_USERNAMES
to False
. If you are using Spirit auth, you probably want that setting off. It's better to set it on for new projects, but probably not a good idea for existing projects.
I did see that there's supposed to be a migration for creating new spirit user profiles? Or has that not been put together yet?
Oh, that's right. There is such migration. Weird, I've no idea what's going on then.
Any reason why the migration wouldn't have worked? it doesn't seem to have run when I ran python manage.py spiritinstall
It should just work. Try this:
python manage.py migrate
python manage.py createcachetable
python manage.py collectstatic
^ That's what spiritinstall
does. Did you add all spirit apps to INSTALLED_APPS
? how did you integrated Spirit into your project? I think the best way is to create a new project following the install instructions, then copying/merging all those project settings into the existing project settings.
I have a wagtail project that I've started with
wagtail start mysite
I've got an existing auth_user table from a different website that I'm pulling over in order to not have to get those users to re-do their accounts.
Once I did that, I copied over the following to my settings/base.py:
'spirit.core',
'spirit.admin',
'spirit.search',
'spirit.user',
'spirit.user.admin',
'spirit.user.auth',
'spirit.category',
'spirit.category.admin',
'spirit.topic',
'spirit.topic.admin',
'spirit.topic.favorite',
'spirit.topic.moderate',
'spirit.topic.notification',
'spirit.topic.private',
'spirit.topic.unread',
'spirit.comment',
'spirit.comment.bookmark',
'spirit.comment.flag',
'spirit.comment.flag.admin',
'spirit.comment.history',
'spirit.comment.like',
'spirit.comment.poll',
'djconfig',
'haystack',
'django_countries',
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
'PATH': os.path.join(BASE_DIR, 'st_search'),
},
}
LOGIN_URL = 'spirit:user:auth:login'
LOGIN_REDIRECT_URL = 'spirit:user:update'
LOGOUT_REDIRECT_URL = 'spirit:index'
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
'LOCATION': 'spirit_cache',
},
'st_rate_limit': {
'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
'LOCATION': 'spirit_rl_cache',
'TIMEOUT': None
}
}
In my settings/dev.py file:
TEMPLATES[0]['OPTIONS']['debug'] = True
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = SECRET_KEY
# SECURITY WARNING: define the correct hosts in production!
ALLOWED_HOSTS = ['*']
try:
from .local import *
except ImportError:
pass
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": "seabirds_test",
"USER": "seabirds",
"PASSWORD": LOCALPASSWORD,
# April 25 2019, set to /tmp/ because postgres was installed to /tmp/ in Linux. Local only.
"HOST": "/tmp/",
"PORT": "5432",
}
}
CACHES.update({
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
},
'st_rate_limit': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'LOCATION': 'spirit_rl_cache',
'TIMEOUT': None
}
})
PASSWORD_HASHERS = [
'django.contrib.auth.hashers.MD5PasswordHasher',
]
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
in urls.py I've got:
import spirit.urls
url(r'^forum/',include('spirit.urls'))
THEN I ran
python manage.py spiritinstall
The users exist in the auth.user table, but the migration didn't work.
I have a wagtail project that I've started with wagtail start mysite I've got an existing auth_user table from a different website that I'm pulling over in order to not have to get those users to re-do their accounts.
I don't quite get it, but Spirit is just a set of apps. It can co-exist with any other apps (including wagtail). There is no need to have two separate DB or anything like that. In fact, that will probably back fire at some point.
Those setting seem ok.
but the migration didn't work.
What do you mean by this? Did it try to run the migrations? what's the output of manage.py migrate
?
Can you copy paste here the settings/base.py
content?
Hmmm... going to close out this issue.. I started from scratch and did it again and the issues seems to have resolved itself. There must have been a funny migration in my attempts to figure this out the first time. Best I can figure out, in my first goes, the django migration that adds 'last_login" = null didn't run.. or may have been overwritten by something. Then the migration that brings the user profiles over to spirit didn't run or was overwritten.
That's very extrange. Even if no data migration ran for some weird reason, all the code does is something like User.objects.filter(email=email).exists()
and if that returns True then this error is raised. It does not use any Spirit model for this.
I guess we will never know what the issue was.
Forever a mystery like bigfoot or the loch ness monster. However - if it comes up again I'll let you know.
I've installed spirit alongside my existing app and hooked into a pre-existing database.
When I try to sign up as a new user, I'm getting an 'E-mail is taken' error, though that e-mail (and any other I have tried) does not exist in the database.