# Flask tryton example

**URL:** https://discuss.tryton.org/t/flask-tryton-example/2500
**Category:** Developer
**Tags:** flask
**Created:** [March 28, 2020, 9:04pm UTC](https://discuss.tryton.org/t/flask-tryton-example/2500 "2020-03-28T21:04:22Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![hidura](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/hidura/32/716_2.png) [@hidura](https://discuss.tryton.org/u/hidura)
#### Post date: [March 28, 2020, 9:04pm UTC](https://discuss.tryton.org/t/flask-tryton-example/2500/1 "2020-03-28T21:04:22Z")

</div>

Hello I am looking for an example of flask tryton, basically I am looking how to connect to the database and add the initial configuration, also I want to know the encryption of the password to make the login using, flask\_login.

Thanks in advance.

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [March 28, 2020, 9:20pm UTC](https://discuss.tryton.org/t/flask-tryton-example/2500/2 "2020-03-28T21:20:07Z")

</div>

Have a look at the [flask\_tryton readme](https://pypi.org/project/flask-tryton/), there is a sample app that work.

---

<div class="post-metadata">

### Author: ![hidura](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/hidura/32/716_2.png) [@hidura](https://discuss.tryton.org/u/hidura)
#### Post date: [March 28, 2020, 9:23pm UTC](https://discuss.tryton.org/t/flask-tryton-example/2500/3 "2020-03-28T21:23:19Z")

</div>

Yes I did, but I dont see where I put the route to the database and how de-encrypt the password on the res\_user table for the login.

---

<div class="post-metadata">

### Author: ![hidura](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/hidura/32/716_2.png) [@hidura](https://discuss.tryton.org/u/hidura)
#### Post date: [March 28, 2020, 9:28pm UTC](https://discuss.tryton.org/t/flask-tryton-example/2500/4 "2020-03-28T21:28:55Z")

</div>

Ive add this to the connection of the database:  
app.config[‘CONFIG’]=‘postgresql://xxxx:xxxxx@localhost/’  
app.config[‘TRYTON\_DATABASE’] = ‘dbname’

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [March 28, 2020, 11:01pm UTC](https://discuss.tryton.org/t/flask-tryton-example/2500/5 "2020-03-28T23:01:31Z")

</div>

> [@hidura](#):
>
> Ive add this to the connection of the database

You must set `TRYTON_CONFIG` to point to your trytond configuration.

> [@hidura](#):
>
> I dont see where I put the route to the database

I do not really understand what route you are talking. But the database to which flask-tryton connect is defined in the configuration `TRYTON_DATABASE`.

> [@hidura](#):
>
> how de-encrypt the password on the res\_user table for the login

It is impossible because the passwords are not encrypted but hashed.  
flask-tryton goals are not to create standard client but website using data from Tryton like an e-commerce. If you need user authentication, I would suggest you to use the `web_user` module.

---

<div class="post-metadata">

### Author: ![hidura](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/hidura/32/716_2.png) [@hidura](https://discuss.tryton.org/u/hidura)
#### Post date: [March 29, 2020, 4:14am UTC](https://discuss.tryton.org/t/flask-tryton-example/2500/6 "2020-03-29T04:14:11Z")

</div>

Thanks, I’ll do it as you tell me.  
But for the authentication, I can work directly with out the authentication?

My goal is to add restaurants module to the system, but as I am looking for that type of company the SAO client and the desktop client are too complicated, so I was thinking on doing a webapplication so the manager can handle the bussiness, and use tryton as backend.  
I’ll need a authentication for that but I can’t find a manual for the web\_user that’s why I was looking to make the authentication module by myself, is there any manual for use of the web\_user?

---

<div class="post-metadata">

### Author: ![semarie](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/semarie/32/112_2.png) [@semarie](https://discuss.tryton.org/u/semarie)
#### Post date: [March 29, 2020, 7:09am UTC](https://discuss.tryton.org/t/flask-tryton-example/2500/7 "2020-03-29T07:09:00Z")

</div>

> [@hidura](#):
>
> My goal is to add restaurants module to the system, but as I am looking for that type of company the SAO client and the desktop client are too complicated, so I was thinking on doing a webapplication so the manager can handle the bussiness, and use tryton as backend.

I think you want to look at [UserApplication](https://docs.tryton.org/projects/server/en/latest/topics/user_application.html). Basically, it permits to declare customs routes (a specialized REST api for example) and manage authentification (routes are accessible with api-key, tryton will manage the mapping key-\>tryton user).

This way you could create a specific interface which use the customized routes.

In standard module, there is [timesheet](https://hg.tryton.org/modules/timesheet/) module which expose specialized api to browser extension [chronos](https://hg.tryton.org/chronos/).

I can’t found it now, but I recall about some mobile application to help with stock move in warehouse: a specialized interface to expose only specific tasks in tryton.

---

<div class="post-metadata">

### Author: ![system](https://discuss-cdn.tryton.org/uploads/default/original/1X/c6f8ec0a40525cdcd50058c734283450a4b3d38b.png) [@system](https://discuss.tryton.org/u/system)
#### Post date: [April 28, 2020, 7:09am UTC](https://discuss.tryton.org/t/flask-tryton-example/2500/8 "2020-04-28T07:09:06Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
