diff --git a/brender.py b/brender.py index e66ec44bfe284d7345138f3b1558695186e14b68..8585c9bf2d8648e123d53276d38375141994e1aa 100755 --- a/brender.py +++ b/brender.py @@ -8,13 +8,13 @@ import subprocess try: import config + print('[Info] Loading configuration from config.py') Server = config.Server Dashboard = config.Dashboard Worker = config.Worker -except: - print('Warning: no configuration file were found!') - print('Warning: will use dafault config settings.') - print('Warning: for more info see config.py_tmpl file o README file.') +except ImportError: + print('[Warning] No configuration file were found! Unsing default config settings.') + print('[Warning] For more info see config.py.example file o README file.') Server = None Dashboard = None Worker = None diff --git a/config.py_tmpl b/config.py.example similarity index 100% rename from config.py_tmpl rename to config.py.example diff --git a/server/__init__.py b/server/__init__.py index a00887cda8b299cea860156c4fadf55971d288a7..e978faf634fdda5633d96991bf0edd5ba4840a85 100644 --- a/server/__init__.py +++ b/server/__init__.py @@ -2,13 +2,14 @@ from server import controllers import model import os -# here is default configuration. Just in case if user will not provide one. -# application is configured to run on local-host and port 9999 +# This is the default server configuration, in case the user will not provide one. +# The Application is configured to run on local-host and port 9999 +# The brender.sqlite database will be created inside of the server folder controllers.app.config.update( DEBUG=False, HOST='localhost', PORT=9999, - DATABASE=os.path.join(os.path.dirname(controllers.__file__), '..', 'brender.sqlite') + DATABASE=os.path.join(os.path.dirname(controllers.__file__), 'brender.sqlite') ) def serve(user_config=None): @@ -20,13 +21,15 @@ def serve(user_config=None): model.DATABASE = config['DATABASE'] model.create_database() - # set SEVER_NAME value according to application configuration + # Set SEVER_NAME value according to application configuration config.update( SERVER_NAME="%s:%d" % (config['HOST'], config['PORT']) ) - # run application + #controllers.app.run(host='0.0.0.0') + + # Run application controllers.app.run( controllers.app.config['HOST'], - controllers.app.config['PORT'] + controllers.app.config['PORT'], ) diff --git a/worker/__init__.py b/worker/__init__.py index 530d4455d3d03975c846fc88ff529543454ba1cb..c020ca5082e3f0b79542cfed0a5eda01a408e905 100644 --- a/worker/__init__.py +++ b/worker/__init__.py @@ -9,7 +9,7 @@ controllers.app.config.update( BRENDER_SERVER='localhost:9999' ) -# we use muliprocessing to register the client the worker to the server +# Use muliprocessing to register the client the worker to the server # while the worker app starts up def serve(user_config=None): config = controllers.app.config