mirror of
https://github.com/coulisse/spiderweb.git
synced 2024-09-21 07:27:09 +00:00
added config file
This commit is contained in:
parent
77b1b251c9
commit
788f0b8e5d
8
example_config.json
Normal file
8
example_config.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"mysql":{
|
||||
"host":"localhost",
|
||||
"user":"myusr",
|
||||
"passwd":"mypwd",
|
||||
"db":"dxcluster"
|
||||
}
|
||||
}
|
6
example_config.yml
Normal file
6
example_config.yml
Normal file
@ -0,0 +1,6 @@
|
||||
mysql:
|
||||
host: localhost
|
||||
user: myuser
|
||||
passwd: mypassword
|
||||
db: dxcluster
|
||||
|
12
webapp.py
12
webapp.py
@ -5,16 +5,18 @@ import json
|
||||
app = flask.Flask(__name__)
|
||||
app.config["DEBUG"] = True
|
||||
|
||||
with open('config.json') as json_data_file:
|
||||
cfg = json.load(json_data_file)
|
||||
|
||||
# A route to return all of the available entries in our catalog.
|
||||
@app.route('/', methods=['GET'])
|
||||
def spots():
|
||||
|
||||
db = my.connect(host='localhost',
|
||||
user='webdb',
|
||||
passwd='Zw73dp',
|
||||
db='dxcluster'
|
||||
db = my.connect(host=cfg['mysql']['host'],
|
||||
user=cfg['mysql']['user'],
|
||||
passwd=cfg['mysql']['passwd'],
|
||||
db=cfg['mysql']['db']
|
||||
)
|
||||
|
||||
cursor = db.cursor()
|
||||
number_of_rows = cursor.execute('''SET NAMES 'utf8';''')
|
||||
number_of_rows = cursor.execute('''SELECT rowid, spotter, freq, spotcall, comment, time from dxcluster.spot ORDER BY rowid desc limit 100;''')
|
||||
|
Loading…
Reference in New Issue
Block a user