Skip to content
Snippets Groups Projects
Commit e338e52c authored by Francesco Siddi's avatar Francesco Siddi
Browse files

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
parent 4907da0c
Branches
Tags
No related merge requests found
......@@ -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
......
File moved
......@@ -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'],
)
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment