diff --git a/contrib/apache/validador.conf.tmpl b/contrib/apache/validador.conf.tmpl
new file mode 100644
index 0000000..6cf4fbc
--- /dev/null
+++ b/contrib/apache/validador.conf.tmpl
@@ -0,0 +1,28 @@
+
+ ServerName localhost
+
+ WSGIDaemonProcess validador user=user1 group=group1 threads=5
+ WSGIScriptAlias /validador-backend /contrib/validador.wsgi
+
+ >
+ WSGIProcessGroup validador
+ WSGIApplicationGroup %{GLOBAL}
+ Order deny,allow
+ Allow from all
+ Require all granted
+
+
+ Alias /validador /view
+ /view>
+ Order deny,allow
+ Allow from all
+ Require all granted
+
+
+ Header set Access-Control-Allow-Origin "*"
+
+ ServerAdmin webmaster@localhost
+
+ ErrorLog ${APACHE_LOG_DIR}/error.log
+ CustomLog ${APACHE_LOG_DIR}/access.log combined
+
diff --git a/contrib/validador.wsgi.tmpl b/contrib/validador.wsgi.tmpl
new file mode 100644
index 0000000..74b13b5
--- /dev/null
+++ b/contrib/validador.wsgi.tmpl
@@ -0,0 +1,11 @@
+# Check the official documentation http://flask.pocoo.org/docs/deploying/mod_wsgi/
+# Activate the virtual env (we assume that virtualenv is in the env folder)
+activate_this = '/env/bin/activate_this.py'
+execfile(activate_this, dict(__file__=activate_this))
+import logging, sys
+sys.stdout = sys.stderr
+logging.basicConfig(stream=sys.stderr)
+sys.path.insert(0,'')
+
+# Run the web-app
+from main import app as application
diff --git a/main.py b/main.py
index acc3ca4..e175c50 100644
--- a/main.py
+++ b/main.py
@@ -7,15 +7,8 @@ import os
import pyutil
app = Flask(__name__)
-CORS(app)
controller = None
-@app.route("/")
-def send_static_files(path):
- root_dir = os.path.abspath(os.path.dirname(__file__))
- file_dir = os.path.join(root_dir, "view")
- return send_from_directory(file_dir, path)
-
@app.route("/update_project")
def update_project():
try:
@@ -45,17 +38,34 @@ def read_settings(app):
config_path = os.path.join(os.path.dirname(here), 'settings_local.py')
if os.path.exists(config_path):
app.config.from_pyfile(config_path)
- app.config['HOST_ENDPOINT'] = "http://" + app.config['SERVER_HOST'] + ":" + str(app.config['SERVER_PORT'])
+
+ if app.config['APACHE_HOST']:
+ app.config['HOST_ENDPOINT'] = "http://" + app.config['SERVER_HOST'] + app.config['APACHE_HOST_ENDPOINT']
+ app.config['HOST_STATIC_FILES_ENDPOINT'] = "http://" + app.config['SERVER_HOST'] + app.config['APACHE_STATIC_FILES_ENDPOINT']
+ else:
+ app.config['HOST_ENDPOINT'] = "http://" + app.config['SERVER_HOST'] + ":" + str(app.config['SERVER_PORT'])
+ app.config['HOST_STATIC_FILES_ENDPOINT'] = app.config['HOST_ENDPOINT']
def setup_controller():
global controller
read_settings(app)
env = Environment(loader=PackageLoader('main', 'view'))
controller = Validador(app.config, env)
+
+def setup_static_files_service(app):
+ if not app.config['APACHE_HOST']:
+ CORS(app)
+ @app.route("/")
+ def send_static_files(path):
+ root_dir = os.path.abspath(os.path.dirname(__file__))
+ file_dir = os.path.join(root_dir, "view")
+ return send_from_directory(file_dir, path)
def run():
- setup_controller()
app.run(host=app.config['SERVER_HOST'], port=app.config['SERVER_PORT'])
+
+setup_controller()
+setup_static_files_service(app)
if __name__ == '__main__':
try:
diff --git a/settings_local.py.tmpl b/settings_local.py.tmpl
index 29ae7ad..a40d4dc 100644
--- a/settings_local.py.tmpl
+++ b/settings_local.py.tmpl
@@ -1,9 +1,14 @@
# -*- coding: utf-8 -*-
-# Corretor Server Configuration
+# Validador Server Configuration
SERVER_HOST = "localhost"
SERVER_PORT = 8001
AGREEMENT_NUMBER = 3
+# Apache Configuration
+APACHE_HOST = False
+APACHE_HOST_ENDPOINT = "/validador-backend"
+APACHE_STATIC_FILES_ENDPOINT = "/validador"
+
# PyBossa Configuration
PYBOSSA_APP_NAME = "Validador de Sinais"
PYBOSSA_APP_SHORT_NAME = "validador_sinais"
diff --git a/validador.py b/validador.py
index b161ac2..8f2f2db 100644
--- a/validador.py
+++ b/validador.py
@@ -32,10 +32,11 @@ class Validador:
def __update_project_info(self, project):
template = self.env.get_template('template.html')
- project.info['task_presenter'] = template.render(server=self.config['HOST_ENDPOINT'], app_shortname=self.config['PYBOSSA_APP_SHORT_NAME'])
+ project.info['task_presenter'] = template.render(server=self.config['HOST_STATIC_FILES_ENDPOINT'], server_backend=self.config['HOST_ENDPOINT'], app_shortname=self.config['PYBOSSA_APP_SHORT_NAME'])
project.info['thumbnail'] = self.config['HOST_ENDPOINT'] + "/img/thumbnail.png"
project.info['sched'] = "incremental"
project.allow_anonymous_contributors = False
+ #project.published = True
pbclient.update_project(project)
def create_project(self):
diff --git a/view/assets/js/validador.js b/view/assets/js/validador.js
old mode 100644
new mode 100755
index 2b2f763..0fb4aa8
--- a/view/assets/js/validador.js
+++ b/view/assets/js/validador.js
@@ -2,6 +2,7 @@
var videos_url = "";
var base_url = "";
+ var server_backend_url = '';
var current_task_id = -1;
function _disableFinishButton() {
@@ -162,7 +163,7 @@
$
.ajax({
type : "POST",
- url : base_url + "/finish_task",
+ url : server_backend_url + "/finish_task",
data : {
"task_id" : task.id,
"project_id" : task.project_id,
@@ -235,8 +236,9 @@
}
// Public methods
- validador.run = function(serverhost, projectname) {
+ validador.run = function(serverhost, serverbackend, projectname) {
base_url = serverhost;
+ server_backend_url = serverbackend;
videos_url = base_url + "/videos/";
_run(projectname);
};
diff --git a/view/img/correct.png b/view/img/correct.png
old mode 100644
new mode 100755
index 3340434..3340434
Binary files a/view/img/correct.png and b/view/img/correct.png differ
diff --git a/view/img/incorrect.png b/view/img/incorrect.png
old mode 100644
new mode 100755
index be2d49f..be2d49f
Binary files a/view/img/incorrect.png and b/view/img/incorrect.png differ
diff --git a/view/img/loading.gif b/view/img/loading.gif
old mode 100644
new mode 100755
index 0fcd282..0fcd282
Binary files a/view/img/loading.gif and b/view/img/loading.gif differ
diff --git a/view/img/thumbnail.png b/view/img/thumbnail.png
old mode 100644
new mode 100755
index ead10bc..ead10bc
Binary files a/view/img/thumbnail.png and b/view/img/thumbnail.png differ
diff --git a/view/template.html b/view/template.html
index a16db2f..2292692 100755
--- a/view/template.html
+++ b/view/template.html
@@ -99,5 +99,5 @@
diff --git a/view/videos/ENSINADO_AVATAR.webm b/view/videos/ENSINADO_AVATAR.webm
old mode 100644
new mode 100755
index daa1f9d..daa1f9d
Binary files a/view/videos/ENSINADO_AVATAR.webm and b/view/videos/ENSINADO_AVATAR.webm differ
diff --git a/view/videos/ENSINADO_REF.webm b/view/videos/ENSINADO_REF.webm
old mode 100644
new mode 100755
index 5a6c143..5a6c143
Binary files a/view/videos/ENSINADO_REF.webm and b/view/videos/ENSINADO_REF.webm differ
diff --git a/view/videos/ENTANTO_AVATAR.webm b/view/videos/ENTANTO_AVATAR.webm
old mode 100644
new mode 100755
index d80339e..d80339e
Binary files a/view/videos/ENTANTO_AVATAR.webm and b/view/videos/ENTANTO_AVATAR.webm differ
diff --git a/view/videos/ENTANTO_REF.webm b/view/videos/ENTANTO_REF.webm
old mode 100644
new mode 100755
index b9ac680..b9ac680
Binary files a/view/videos/ENTANTO_REF.webm and b/view/videos/ENTANTO_REF.webm differ
diff --git a/view/videos/ENTENDIDO_AVATAR.webm b/view/videos/ENTENDIDO_AVATAR.webm
old mode 100644
new mode 100755
index fd64277..fd64277
Binary files a/view/videos/ENTENDIDO_AVATAR.webm and b/view/videos/ENTENDIDO_AVATAR.webm differ
diff --git a/view/videos/ENTENDIDO_REF.webm b/view/videos/ENTENDIDO_REF.webm
old mode 100644
new mode 100755
index b5bf46e..b5bf46e
Binary files a/view/videos/ENTENDIDO_REF.webm and b/view/videos/ENTENDIDO_REF.webm differ
--
libgit2 0.21.2