Failed: Database access not allowed, use the "django_db" mark, or the "db" or "transactional_db" fixtures to enable it
I've found the problem.Instead of manually creating the factory:
created_by = UserFactory()
I have to use the SubFactory
created_by = factory.SubFactory(UserFactory)