successful connect with pydapper connection pool and local DB
This commit is contained in:
parent
695c5afee8
commit
7898a72fdb
@ -3,11 +3,15 @@ from flask import Flask
|
|||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
import mysql.connector
|
||||||
|
import pydapper
|
||||||
|
|
||||||
from .api import shipcalls
|
from .api import shipcalls
|
||||||
from .api import verify
|
from .api import verify
|
||||||
from .api import participant
|
from .api import participant
|
||||||
from .api import times
|
from .api import times
|
||||||
from .api import notifications
|
from .api import notifications
|
||||||
|
from .api import berths
|
||||||
|
|
||||||
|
|
||||||
def create_app(test_config=None):
|
def create_app(test_config=None):
|
||||||
@ -32,8 +36,18 @@ def create_app(test_config=None):
|
|||||||
app.register_blueprint(participant.bp)
|
app.register_blueprint(participant.bp)
|
||||||
app.register_blueprint(times.bp)
|
app.register_blueprint(times.bp)
|
||||||
app.register_blueprint(notifications.bp)
|
app.register_blueprint(notifications.bp)
|
||||||
|
app.register_blueprint(berths.bp)
|
||||||
|
|
||||||
logging.basicConfig(filename='brecal.log', level=logging.DEBUG, format='%(asctime)s | %(name)s | %(levelname)s | %(message)s')
|
logging.basicConfig(filename='brecal.log', level=logging.DEBUG, format='%(asctime)s | %(name)s | %(levelname)s | %(message)s')
|
||||||
logging.info('App started')
|
logging.info('App started')
|
||||||
|
|
||||||
|
conn_from_pool = mysql.connector.connect(
|
||||||
|
pool_name="brecal_pool", pool_size=10, port=3306, user="ds", password="HalloWach23", database="bremen_calling"
|
||||||
|
)
|
||||||
|
|
||||||
|
# test connection
|
||||||
|
commands = pydapper.using(conn_from_pool)
|
||||||
|
data = commands.query_single("SELECT id from `user`")
|
||||||
|
print(data)
|
||||||
|
|
||||||
return app
|
return app
|
||||||
|
|||||||
@ -10,6 +10,7 @@ def GetVerify(options):
|
|||||||
"""
|
"""
|
||||||
print(options)
|
print(options)
|
||||||
sentinel = object()
|
sentinel = object()
|
||||||
|
# 'mysql+pymysql://' + username + ':' + password + '@' + server + database
|
||||||
# with connect("mysql+mysql://root:pydapper@localhost:3307/pydapper", autocommit=True) as commands:
|
# with connect("mysql+mysql://root:pydapper@localhost:3307/pydapper", autocommit=True) as commands:
|
||||||
# data = commands.query_single_or_default("SELECT id from `user` WHERE api_key=?", )
|
# data = commands.query_single_or_default("SELECT id from `user` WHERE api_key=?", )
|
||||||
# Implement your business logic here
|
# Implement your business logic here
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user