Skip to content

Commit

Permalink
Adicionando configuração de BIND SERVER
Browse files Browse the repository at this point in the history
  • Loading branch information
duzzsys committed May 22, 2020
1 parent 11ec9e1 commit eb06a6d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions conf.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[config_server]
server_address = 127.0.0.1
server_port = 5000
devs = "Jonas Duarte, Pablo Mariz"

[config_bank_app]
Expand Down
13 changes: 12 additions & 1 deletion rotas.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,21 @@
#__author__ = Pablo Mariz, [email protected]
#Python3

import configparser
from flask import Flask, jsonify, request
from model import Backend
app = Flask(__name__)
backend = Backend()

def bind_server():
config = configparser.ConfigParser()
config.read('conf.cfg')

server_address = config.get('config_server', 'server_address')
server_port = config.get('config_server', 'server_port')

return [server_address, server_port]

#adicionar novo motorista - FUNCIONANDO
@app.route('/novo_veiculo', methods=['POST'])
def novo_veiculo():
Expand Down Expand Up @@ -416,4 +426,5 @@ def realizar_logoff():


if __name__ == "__main__":
app.run(debug=True)
server_address, server_port = bind_server()
app.run(host=server_address, port=server_port)

0 comments on commit eb06a6d

Please sign in to comment.