From e338e52c78af9191904595d2530f8ca6c28e5eaa Mon Sep 17 00:00:00 2001
From: Francesco Siddi <francesco.siddi@gmail.com>
Date: Wed, 19 Feb 2014 12:26:31 +0100
Subject: [PATCH] Small final teaks to the patch

* brender.sqlite database should be created in the server module folder
* Tweaked some warning and info prints
* Renamed config.py_tpl to config.py.example
---
 brender.py                          |  8 ++++----
 config.py_tmpl => config.py.example |  0
 server/__init__.py                  | 15 +++++++++------
 worker/__init__.py                  |  2 +-
 4 files changed, 14 insertions(+), 11 deletions(-)
 rename config.py_tmpl => config.py.example (100%)

diff --git a/brender.py b/brender.py
index e66ec44b..8585c9bf 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 a00887cd..e978faf6 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 530d4455..c020ca50 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
-- 
GitLab