Django fix for ‘User’ object has no attribute ‘backend
I was trying to auto login a user if I had their user object and was getting this error when I just called something like
login(request, user)
Well this is due to Django wanting to make sure you auth the user first. If you want to bypass this you can just use the following before login
user.backend = 'django.contrib.auth.backends.ModelBackend'
This might not be the best solution but it works
MySQL Database size
I found a nice query on the mysql mailing list for getting the total size of each database.
SELECT table_schema "Data Base Name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB", sum( data_free )/ 1024 / 1024 "Free Space in MB" FROM information_schema.TABLES GROUP BY table_schema;