I am trying to build a RESTful API (using Flask) that will be later consumed by a mobile application. I also have a requirement to build a Web Admin. The Web Admin will have functionality that will not be available for the mobile client. The mobile client and Web Admin will also share the same database. 

I have a limitation: 

* I do not know any front-end framework, I will be building the Web Admin using Flask (combining the backend/frontend).

My questions are: 

* For the functionalities that are similar for the mobile and web admin, how can avoid duplicating the code?
* How can I maintain the database? I will be using an ORM, does this mean I have to write the DB models twice? One for the RESTful API and one for the Web Admin that will be directly talking to the database.

EDIT: found similar questions

* [Should the admin application consume the API, or should it access the DB directly?](https://softwareengineering.stackexchange.com/questions/344584/should-the-admin-application-consume-the-api-or-should-it-access-the-db-directl/344632#344632)
* [What's the best way of building an administrative UI for an existing SPA application?](https://softwareengineering.stackexchange.com/questions/257038/whats-the-best-way-of-building-an-administrative-ui-for-an-existing-spa-applica?rq=1)