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
No related branches found
No related tags found
No related merge requests found
...@@ -8,13 +8,13 @@ import subprocess ...@@ -8,13 +8,13 @@ import subprocess
try: try:
import config import config
print('[Info] Loading configuration from config.py')
Server = config.Server Server = config.Server
Dashboard = config.Dashboard Dashboard = config.Dashboard
Worker = config.Worker Worker = config.Worker
except: except ImportError:
print('Warning: no configuration file were found!') print('[Warning] No configuration file were found! Unsing default config settings.')
print('Warning: will use dafault config settings.') print('[Warning] For more info see config.py.example file o README file.')
print('Warning: for more info see config.py_tmpl file o README file.')
Server = None Server = None
Dashboard = None Dashboard = None
Worker = None Worker = None
......
File moved
...@@ -2,13 +2,14 @@ from server import controllers ...@@ -2,13 +2,14 @@ from server import controllers
import model import model
import os import os
# here is default configuration. Just in case if user will not provide one. # This is the default server configuration, in case the user will not provide one.
# application is configured to run on local-host and port 9999 # 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( controllers.app.config.update(
DEBUG=False, DEBUG=False,
HOST='localhost', HOST='localhost',
PORT=9999, 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): def serve(user_config=None):
...@@ -20,13 +21,15 @@ def serve(user_config=None): ...@@ -20,13 +21,15 @@ def serve(user_config=None):
model.DATABASE = config['DATABASE'] model.DATABASE = config['DATABASE']
model.create_database() model.create_database()
# set SEVER_NAME value according to application configuration # Set SEVER_NAME value according to application configuration
config.update( config.update(
SERVER_NAME="%s:%d" % (config['HOST'], config['PORT']) 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.run(
controllers.app.config['HOST'], controllers.app.config['HOST'],
controllers.app.config['PORT'] controllers.app.config['PORT'],
) )
...@@ -9,7 +9,7 @@ controllers.app.config.update( ...@@ -9,7 +9,7 @@ controllers.app.config.update(
BRENDER_SERVER='localhost:9999' 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 # while the worker app starts up
def serve(user_config=None): def serve(user_config=None):
config = controllers.app.config config = controllers.app.config
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment