diff --git a/contrib/apache/corretor.conf.tmpl b/contrib/apache/corretor.conf.tmpl new file mode 100644 index 0000000..649e552 --- /dev/null +++ b/contrib/apache/corretor.conf.tmpl @@ -0,0 +1,28 @@ + + ServerName localhost + + WSGIDaemonProcess corretor user=user1 group=group1 threads=5 + WSGIScriptAlias /corretor-backend /contrib/corretor.wsgi + + > + WSGIProcessGroup corretor + WSGIApplicationGroup %{GLOBAL} + Order deny,allow + Allow from all + Require all granted + + + Alias /corretor /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/corretor.wsgi.tmpl b/contrib/corretor.wsgi.tmpl new file mode 100644 index 0000000..74b13b5 --- /dev/null +++ b/contrib/corretor.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/corretor.py b/corretor.py index 2417d65..caacb0a 100644 --- a/corretor.py +++ b/corretor.py @@ -39,10 +39,11 @@ class Corretor: 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 __find_task(self, project_id, task_id): diff --git a/main.py b/main.py index 8274b10..4e94f42 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: @@ -61,18 +54,35 @@ 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 = Corretor(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: run() diff --git a/settings_local.py.tmpl b/settings_local.py.tmpl index d62ab3e..206ee0b 100644 --- a/settings_local.py.tmpl +++ b/settings_local.py.tmpl @@ -5,6 +5,11 @@ SERVER_PORT = 8000 AGREEMENT_NUMBER = 2 UPLOAD_FOLDER = "/view/uploads" +# Apache Configuration +APACHE_HOST = False +APACHE_HOST_ENDPOINT = "/corretor-backend" +APACHE_STATIC_FILES_ENDPOINT = "/corretor" + # PyBossa Configuration PYBOSSA_APP_NAME = "Corretor de Sinais" PYBOSSA_APP_SHORT_NAME = "corretor_sinais" diff --git a/view/assets/js/corretor.js b/view/assets/js/corretor.js old mode 100644 new mode 100755 index 84c422c..6c2e424 --- a/view/assets/js/corretor.js +++ b/view/assets/js/corretor.js @@ -1,6 +1,7 @@ (function(corretor, $, undefined) { var base_url = ""; + var server_backend_url = ""; var videos_url = "/videos/"; var uploads_url = "/uploads/"; var upload_session_id = _getUploadSessionID(); @@ -91,14 +92,14 @@ $("#fix-button").hide(); } - function setupButtons(task, deferred) { + function _setupGUI(task, deferred) { _disableFinishButton(); _resetUploadProgress(); $("#upload-file-name").text("Escolha um arquivo"); $("#file-upload").val(""); $("#file-upload").fileupload( { - url : base_url + "/upload", + url : server_backend_url + "/upload", formData : { "upload_session_id" : upload_session_id, 'sign_name' : task.info.sign_name @@ -167,7 +168,7 @@ _enableLoading(); $.ajax({ type : "POST", - url : base_url + "/render_video", + url : server_backend_url + "/render_video", data : { "upload_session_id" : upload_session_id, "sign_name" : task.info.sign_name @@ -188,7 +189,7 @@ _enableLoading(); $.ajax({ type : "POST", - url : base_url + "/finish_task", + url : server_backend_url + "/finish_task", data : { "task_id" : task.id, "project_id" : task.project_id, @@ -259,7 +260,7 @@ pybossa.presentTask(function(task, deferred) { if (!$.isEmptyObject(task) && current_task_id != task.id) { _loadTaskInfo(task, deferred); - setupButtons(task, deferred); + _setupGUI(task, deferred); $("#success").hide(); $("#main-container").fadeIn(500); } else { @@ -274,8 +275,9 @@ } // Public methods - corretor.run = function(serverhost, projectname) { + corretor.run = function(serverhost, serverbackend, projectname) { base_url = serverhost; + server_backend_url = serverbackend; videos_url = base_url + videos_url; uploads_url = base_url + uploads_url; _run(projectname); diff --git a/view/assets/js/jquery.fileupload.js b/view/assets/js/jquery.fileupload.js old mode 100644 new mode 100755 index 91b7254..91b7254 --- a/view/assets/js/jquery.fileupload.js +++ b/view/assets/js/jquery.fileupload.js diff --git a/view/assets/js/jquery.iframe-transport.js b/view/assets/js/jquery.iframe-transport.js old mode 100644 new mode 100755 index a7d34e0..a7d34e0 --- a/view/assets/js/jquery.iframe-transport.js +++ b/view/assets/js/jquery.iframe-transport.js diff --git a/view/assets/js/jquery.ui.widget.js b/view/assets/js/jquery.ui.widget.js old mode 100644 new mode 100755 index e08df3f..e08df3f --- a/view/assets/js/jquery.ui.widget.js +++ b/view/assets/js/jquery.ui.widget.js diff --git a/view/assets/js/js.cookie.js b/view/assets/js/js.cookie.js old mode 100644 new mode 100755 index afd524d..afd524d --- a/view/assets/js/js.cookie.js +++ b/view/assets/js/js.cookie.js diff --git a/view/assets/js/moment.js b/view/assets/js/moment.js old mode 100644 new mode 100755 index 23cd3ed..23cd3ed --- a/view/assets/js/moment.js +++ b/view/assets/js/moment.js diff --git a/view/img/blender.svg b/view/img/blender.svg old mode 100644 new mode 100755 index bc1a3a9..bc1a3a9 --- a/view/img/blender.svg +++ b/view/img/blender.svg diff --git a/view/img/download.svg b/view/img/download.svg old mode 100644 new mode 100755 index 5090b4c..5090b4c --- a/view/img/download.svg +++ b/view/img/download.svg diff --git a/view/img/finish.svg b/view/img/finish.svg old mode 100644 new mode 100755 index 639e679..639e679 --- a/view/img/finish.svg +++ b/view/img/finish.svg diff --git a/view/img/fix.png b/view/img/fix.png old mode 100644 new mode 100755 index 7076867..7076867 Binary files a/view/img/fix.png and b/view/img/fix.png differ diff --git a/view/img/fix.svg b/view/img/fix.svg old mode 100644 new mode 100755 index 95acfd9..95acfd9 --- a/view/img/fix.svg +++ b/view/img/fix.svg 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/paperclip.svg b/view/img/paperclip.svg old mode 100644 new mode 100755 index d55b273..d55b273 --- a/view/img/paperclip.svg +++ b/view/img/paperclip.svg diff --git a/view/img/skip.svg b/view/img/skip.svg old mode 100644 new mode 100755 index 7caf611..7caf611 --- a/view/img/skip.svg +++ b/view/img/skip.svg 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 3c633d8..10bc3ea 100755 --- a/view/template.html +++ b/view/template.html @@ -68,7 +68,6 @@ style="width: 22px; height: 22px"> -
ENVIAR ARQUIVO DE ANIMAÇÃO BLENDER CORRIGIDO:
@@ -131,5 +130,5 @@
diff --git a/view/videos/.gitempty b/view/videos/.gitempty old mode 100644 new mode 100755 index e69de29..e69de29 --- a/view/videos/.gitempty +++ b/view/videos/.gitempty diff --git a/view/videos/ENSINADO_AVATAR.blend b/view/videos/ENSINADO_AVATAR.blend old mode 100644 new mode 100755 index bd8b678..bd8b678 Binary files a/view/videos/ENSINADO_AVATAR.blend and b/view/videos/ENSINADO_AVATAR.blend differ diff --git a/view/videos/ENSINADO_AVATAR.mp4 b/view/videos/ENSINADO_AVATAR.mp4 old mode 100644 new mode 100755 index 3f55030..3f55030 Binary files a/view/videos/ENSINADO_AVATAR.mp4 and b/view/videos/ENSINADO_AVATAR.mp4 differ 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.mp4 b/view/videos/ENSINADO_REF.mp4 old mode 100644 new mode 100755 index c47d6d9..c47d6d9 Binary files a/view/videos/ENSINADO_REF.mp4 and b/view/videos/ENSINADO_REF.mp4 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.blend b/view/videos/ENTANTO_AVATAR.blend old mode 100644 new mode 100755 index 69bb9ac..69bb9ac Binary files a/view/videos/ENTANTO_AVATAR.blend and b/view/videos/ENTANTO_AVATAR.blend differ diff --git a/view/videos/ENTANTO_AVATAR.mp4 b/view/videos/ENTANTO_AVATAR.mp4 old mode 100644 new mode 100755 index 39c76d0..39c76d0 Binary files a/view/videos/ENTANTO_AVATAR.mp4 and b/view/videos/ENTANTO_AVATAR.mp4 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.mp4 b/view/videos/ENTANTO_REF.mp4 old mode 100644 new mode 100755 index 392c247..392c247 Binary files a/view/videos/ENTANTO_REF.mp4 and b/view/videos/ENTANTO_REF.mp4 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.blend b/view/videos/ENTENDIDO_AVATAR.blend old mode 100644 new mode 100755 index dc82dba..dc82dba Binary files a/view/videos/ENTENDIDO_AVATAR.blend and b/view/videos/ENTENDIDO_AVATAR.blend differ diff --git a/view/videos/ENTENDIDO_AVATAR.mp4 b/view/videos/ENTENDIDO_AVATAR.mp4 old mode 100644 new mode 100755 index 003df6d..003df6d Binary files a/view/videos/ENTENDIDO_AVATAR.mp4 and b/view/videos/ENTENDIDO_AVATAR.mp4 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.mp4 b/view/videos/ENTENDIDO_REF.mp4 old mode 100644 new mode 100755 index 49b91fc..49b91fc Binary files a/view/videos/ENTENDIDO_REF.mp4 and b/view/videos/ENTENDIDO_REF.mp4 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