From 7544e3c447a5a2872d0451e279c56b6b7a086e9e Mon Sep 17 00:00:00 2001 From: Lulzette Date: Mon, 1 Nov 2021 04:58:13 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=D1=83=D1=80=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D1=8E=20=D1=81=D0=B0=D0=BC=D0=BE=D0=B3=D0=BE=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B8=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 4690a59..ea98173 100755 --- a/main.py +++ b/main.py @@ -44,11 +44,15 @@ class Config: self.createConfig(config) db = config['DB'] - self.host = db['host'] self.port = int(db['port']) 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): """ Create config file @@ -59,6 +63,12 @@ class Config: db['port'] = '27017' 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: config.write(cfgfile) @@ -158,4 +168,4 @@ if __name__ == '__main__': print("Configured") back = Back() 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)