Code structure: moving parts of factory to extensions

I started moving some parts of factory.py to separate files. However, I am sure which parts should be moved and which not. Sections that seem separate entities:
- database (in the beginning, setting some urls + calling db.init_app(app)
- secret_key 
- legacy
- cache 
- jinja 
- gravatar
- blueprints
- admin
Where should each of the sections be moved? (extensions? some other module?)