Добавил конфигурацию самого приложения
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Lulzette 2021-11-01 04:58:13 +03:00
parent 96790be6f7
commit 7544e3c447

14
main.py
View File

@ -44,11 +44,15 @@ class Config:
self.createConfig(config) self.createConfig(config)
db = config['DB'] db = config['DB']
self.host = db['host'] self.host = db['host']
self.port = int(db['port']) self.port = int(db['port'])
self.dbname = db['name'] self.dbname = db['name']
app = config['App']
self.apphost = app['host']
self.appport = int(app['port'])
self.appdebug = bool(app['debug'])
def createConfig(self, config): def createConfig(self, config):
""" """
Create config file Create config file
@ -59,6 +63,12 @@ class Config:
db['port'] = '27017' db['port'] = '27017'
db['name'] = 'pycms' db['name'] = 'pycms'
config['App'] = {}
app = config['App']
app['port'] = '8080'
app['debug'] = 'True'
app['host'] = '0.0.0.0'
with open('config.ini', 'w') as cfgfile: with open('config.ini', 'w') as cfgfile:
config.write(cfgfile) config.write(cfgfile)
@ -158,4 +168,4 @@ if __name__ == '__main__':
print("Configured") print("Configured")
back = Back() back = Back()
posts = cfg.posts posts = cfg.posts
run(host='0.0.0.0', port=8080, reloader=True, debug=True) run(host=cfg.apphost, port=cfg.appport, reloader=cfg.appdebug, debug=cfg.appdebug)