Updated paths for deployment.

master
lkrsnik 3 months ago
parent ab6a905093
commit 28c7e9e4e1

@ -60,7 +60,7 @@ def get_locale():
def create_app():
app = Flask(__name__)
app = Flask(__name__, static_url_path='/stark/static')
@ -108,24 +108,11 @@ def create_app():
return '.' in filename and \
filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
@app.route('/upload')
def upload_file2():
return render_template('upload.html')
@app.route('/uploader', methods=['GET', 'POST'])
def upload_file():
if request.method == 'POST':
f = request.files['file']
f.save(secure_filename(f.filename))
return 'file uploaded successfully'
@app.route('/about', methods=['GET'])
@app.route('/stark/about', methods=['GET'])
def about():
return render_template('about.html')
@app.route('/result/<result_id>', methods=['GET', 'POST'])
@app.route('/stark/result/<result_id>', methods=['GET', 'POST'])
def result(result_id):
if request.method == 'POST':
@ -167,7 +154,7 @@ def create_app():
displayed_content_dict[TABLE_COLUMNS2DISPLAYED_TABLE_COLUMNS[column]] = v
return render_template('result.html', head_row=displayed_head, content=displayed_content_dict)
@app.route('/', methods=['GET', 'POST'])
@app.route('/stark/', methods=['GET', 'POST'])
# @headers({'Cache-Control': 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0'})
def index():
translations = _translations[get_locale()]
@ -274,27 +261,30 @@ def create_app():
else:
configs['query'] = None
# handling input
if 'compare_file' in request.files and request.files['compare_file']:
# store file
f = request.files['compare_file']
input_path = os.path.join('media', secure_filename(f.filename))
f.save(input_path)
# handling input
if 'compare_file' in request.files and request.files['compare_file']:
# store file
f = request.files['compare_file']
input_path = os.path.join('media', secure_filename(f.filename))
f.save(input_path)
configs['compare'] = input_path
if 'compare_url' in form and form['compare_url']:
validation['compare_file'] = gettext('Please insert either compare url or file, not both of them.')
validation['compare_url'] = gettext('Please insert either compare url or file, not both of them.')
elif 'compare_url' in form and form['compare_url']:
try:
name = form['compare_url'].split('/')[-1]
input_path = os.path.join('media', name)
response = requests.get(form['compare_url'])
open(input_path, "wb").write(response.content)
configs['compare'] = input_path
if 'compare_url' in form and form['compare_url']:
validation['compare_file'] = gettext('Please insert either compare url or file, not both of them.')
validation['compare_url'] = gettext('Please insert either compare url or file, not both of them.')
elif 'compare_url' in form and form['compare_url']:
try:
name = form['compare_url'].split('/')[-1]
input_path = os.path.join('media', name)
response = requests.get(form['compare_url'])
open(input_path, "wb").write(response.content)
configs['compare'] = input_path
except:
validation['compare_url'] = gettext('Incorrect URL!')
except:
configs['compare'] = None
validation['compare_url'] = gettext('Incorrect URL!')
else:
configs['compare'] = None
configs['sentence_count_file'] = None
configs['detailed_results_file'] = None

@ -1,6 +1,6 @@
// Global array to store input names
var globalInputList = ['tree_size_min', 'tree_size_max', 'file', 'association_measures', 'labeled_trees', 'node_type_upos', 'fixed_order', 'input_url', 'node_type_lemma', 'root_restriction', 'node_type_form', 'frequency_threshold'];
//const URLSearchParams = window.URLSearchParams;
// Function to store values to local storage
function storeValuesToLocalstorage() {
globalInputList.forEach(function(inputName) {
@ -75,24 +75,6 @@ document.addEventListener("DOMContentLoaded", function(event) {
},
format: format
});
/*
// OLD VERSION
var perfEntries = performance.getEntriesByType("navigation");
for (var i = 0; i < perfEntries.length; i++) {
if (perfEntries[i].type === 'back_forward') {
window.location.href = '?noreload=true'
return;
}
}
var urlParams = new URLSearchParams(window.location.search);
if (!urlParams.has('noreload')) {
if (Object.keys(localStorage).length > 1) {
localStorage.clear();
window.location.href = '?noreload=true'
}
}*/
var urlParams = new URLSearchParams(window.location.search);
var lang='en'
@ -103,17 +85,15 @@ document.addEventListener("DOMContentLoaded", function(event) {
var perfEntries = performance.getEntriesByType("navigation");
for (var i = 0; i < perfEntries.length; i++) {
if (perfEntries[i].type === 'back_forward') {
window.location.href = '/?lang='+lang;
window.location.href = '/stark/?lang='+lang;
return;
}
}
if (urlParams.has('reload')) {
// if (Object.keys(localStorage).length > 1) {
localStorage.clear();
window.location.href = '/?lang='+lang;
// }
window.location.href = '/stark/?lang='+lang;
}
});
@ -123,11 +103,9 @@ document.addEventListener("DOMContentLoaded", function(event) {
$('.sidenav').sidenav();
}); // end of document ready
});
$(document).ready(function(){
$('.modal').modal();
// var instance = M.Modal.getInstance(elem);
// instance.open();
$('.input-field input[type="checkbox"]').on('change', function() {
var isChecked = $('.input-field input[type="checkbox"]:checked').length > 0;
@ -186,5 +164,5 @@ document.addEventListener("DOMContentLoaded", function(event) {
storeValuesToLocalstorage();
return true;
});
})(jQuery); // end of jQuery name space
})(jQuery);

@ -15,9 +15,9 @@
</head>
<body>
<nav class="redcjvt" role="navigation">
<div class="nav-wrapper container"><a id="logo-container" href="/?lang={{ _('code') }}&reload=true" class="brand-logo">STARK</a>
<div class="nav-wrapper container"><a id="logo-container" href="{{url_for('index')}}?lang={{ _('code') }}&reload=true" class="brand-logo">STARK</a>
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li><a href="/about?lang={{ _('code') }}">{{ _('About') }}</a></li>
<li><a href="{{url_for('about')}}?lang={{ _('code') }}">{{ _('About') }}</a></li>
<li><a id="switch-language" href="{{ _('switch_link') }}">
{{ _('switch_code') }}
</a></li>

@ -1,195 +0,0 @@
<!DOCTYPE html>
<!--
// WEBSITE: https://themefisher.com
// TWITTER: https://twitter.com/themefisher
// FACEBOOK: https://www.facebook.com/themefisher
// GITHUB: https://github.com/themefisher/
-->
<html lang="en">
<head>
<!-- Basic Page Needs
================================================== -->
<meta charset="utf-8">
<title>Aviato | E-commerce template</title>
<!-- Mobile Specific Metas
================================================== -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="Construction Html5 Template">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0">
<meta name="author" content="Themefisher">
<meta name="generator" content="Themefisher Constra HTML Template v1.0">
<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="static/images/favicon.png" />
<!-- Themefisher Icon font -->
<link rel="stylesheet" href="static/plugins/themefisher-font/style.css">
<!-- bootstrap.min css -->
<link rel="stylesheet" href="static/plugins/bootstrap/css/bootstrap.min.css">
<!-- Animate css -->
<link rel="stylesheet" href="static/plugins/animate/animate.css">
<!-- Slick Carousel -->
<link rel="stylesheet" href="static/plugins/slick/slick.css">
<link rel="stylesheet" href="static/plugins/slick/slick-theme.css">
<!-- Main Stylesheet -->
<link rel="stylesheet" href="static/css/style.css">
</head>
<body id="body">
<!-- Start Top Header Bar -->
<div class="page-wrapper">
<div class="checkout shopping">
<div class="container">
<div class="row">
<div class="col-md-8">
<form class="checkout-form" action="http://localhost:5000/" method="POST" enctype="multipart/form-data">
<div class="block billing-details">
<h4 class="widget-title">General settings</h4>
<div class="form-group">
<label for="input_file">Input file</label>
<input type="file" name="file" class="form-control" id="input_file">
</div>
<div class="form-group">
<label for="input_url">Input url</label>
<input type="text" name="input_url" class="form-control" id="input_url" placeholder="">
</div>
</div>
<div class="block">
<h4 class="widget-title">Tree specifications</h4>
<p>Specifications for trees</p>
<div class="form-group">
<label for="complete">Complete</label>
<input type="text" name="complete" class="form-control" id="complete" placeholder="">
</div>
<input class="btn btn-main mt-20" type="submit" value="submit" />
<!-- <a href="confirmation.html" class="btn btn-main mt-20">Place Order</a >-->
</div>
</form>
</div>
<!-- <div class="col-md-4">-->
<!-- <div class="product-checkout-details">-->
<!-- <div class="block">-->
<!-- <h4 class="widget-title">Order Summary</h4>-->
<!-- <div class="media product-card">-->
<!-- <a class="pull-left" href="product-single.html">-->
<!-- <img class="media-object" src="images/shop/cart/cart-1.jpg" alt="Image" />-->
<!-- </a>-->
<!-- <div class="media-body">-->
<!-- <h4 class="media-heading"><a href="product-single.html">Ambassador Heritage 1921</a></h4>-->
<!-- <p class="price">1 x $249</p>-->
<!-- <span class="remove" >Remove</span>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="discount-code">-->
<!-- <p>Have a discount ? <a data-toggle="modal" data-target="#coupon-modal" href="#!">enter it here</a></p>-->
<!-- </div>-->
<!-- <ul class="summary-prices">-->
<!-- <li>-->
<!-- <span>Subtotal:</span>-->
<!-- <span class="price">$190</span>-->
<!-- </li>-->
<!-- <li>-->
<!-- <span>Shipping:</span>-->
<!-- <span>Free</span>-->
<!-- </li>-->
<!-- </ul>-->
<!-- <div class="summary-total">-->
<!-- <span>Total</span>-->
<!-- <span>$250</span>-->
<!-- </div>-->
<!-- <div class="verified-icon">-->
<!-- <img src="images/shop/verified.png">-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="coupon-modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body">
<form>
<div class="form-group">
<input class="form-control" type="text" placeholder="Enter Coupon Code">
</div>
<button type="submit" class="btn btn-main">Apply Coupon</button>
</form>
</div>
</div>
</div>
</div>
<footer class="footer section text-center">
<div class="container">
<div class="row">
<div class="col-md-12">
<ul class="social-media">
<li>
<a href="https://www.facebook.com/themefisher">
<i class="tf-ion-social-facebook"></i>
</a>
</li>
<li>
<a href="https://www.instagram.com/themefisher">
<i class="tf-ion-social-instagram"></i>
</a>
</li>
<li>
<a href="https://www.twitter.com/themefisher">
<i class="tf-ion-social-twitter"></i>
</a>
</li>
<li>
<a href="https://www.pinterest.com/themefisher/">
<i class="tf-ion-social-pinterest"></i>
</a>
</li>
</ul>
</div>
</div>
</div>
</footer>
<!--
Essential Scripts
=====================================-->
<!-- Main jQuery -->
<script src="{{url_for('static', filename='plugins/jquery/dist/jquery.min.js')}}"></script>
<!-- Bootstrap 3.1 -->
<script src="{{url_for('static', filename='plugins/bootstrap/js/bootstrap.min.js')}}"></script>
<!-- Bootstrap Touchpin -->
<script src="{{url_for('static', filename='plugins/bootstrap-touchspin/dist/jquery.bootstrap-touchspin.min.js')}}"></script>
<!-- Instagram Feed Js -->
<script src="{{url_for('static', filename='plugins/instafeed/instafeed.min.js')}}"></script>
<!-- Video Lightbox Plugin -->
<script src="{{url_for('static', filename='plugins/ekko-lightbox/dist/ekko-lightbox.min.js')}}"></script>
<!-- Count Down Js -->
<script src="{{url_for('static', filename='plugins/syo-timer/build/jquery.syotimer.min.js')}}"></script>
<!-- slick Carousel -->
<script src="{{url_for('static', filename='plugins/slick/slick.min.js')}}"></script>
<script src="{{url_for('static', filename='plugins/slick/slick-animation.min.js')}}"></script>
<!-- Google Mapl -->
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCC72vZw-6tGqFyRhhg5CkF2fqfILn2Tsw"></script>
<script src="{{url_for('static', filename='plugins/google-map/gmap.js')}}"></script>
<!-- Main Js File -->
<script src="{{url_for('static', filename='js/script.js')}}"></script>
</body>
</html>

@ -15,9 +15,9 @@
</head>
<body class="backgroundcolorcjvt">
<nav class="redcjvt" role="navigation">
<div class="nav-wrapper container"><a id="logo-container" href="/?lang={{ _('code') }}&reload=true" class="brand-logo">STARK</a>
<div class="nav-wrapper container"><a id="logo-container" href="{{url_for('index')}}?lang={{ _('code') }}&reload=true" class="brand-logo">STARK</a>
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li><a href="/about?lang={{ _('code') }}">{{ _('About') }}</a></li>
<li><a href="{{url_for('about')}}?lang={{ _('code') }}">{{ _('About') }}</a></li>
<li><a id="switch-language" href="{{ _('switch_link') }}">
{{ _('switch_code') }}
</a></li>

@ -7,17 +7,17 @@
<!-- CSS -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="/static/css/materialize.css" type="text/css" rel="stylesheet" media="screen,projection"/>
<link href="/static/css/nouislider.css" type="text/css" rel="stylesheet" media="screen,projection"/>
<link href="/static/css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/>
<link href="/stark/static/css/materialize.css" type="text/css" rel="stylesheet" media="screen,projection"/>
<link href="/stark/static/css/nouislider.css" type="text/css" rel="stylesheet" media="screen,projection"/>
<link href="/stark/static/css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/>
<link rel="icon" type="image/svg+xml" href="static/favicon/favicon.svg">
<link rel="icon" type="image/svg+xml" href="/stark/static/favicon/favicon.svg">
</head>
<body>
<nav class="redcjvt" role="navigation">
<div class="nav-wrapper container"><a id="logo-container" href="/?lang={{ _('code') }}&reload=true" class="brand-logo">STARK</a>
<div class="nav-wrapper container"><a id="logo-container" href="{{url_for('index')}}?lang={{ _('code') }}&reload=true" class="brand-logo">STARK</a>
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li><a href="/about?lang={{ _('code') }}">{{ _('About') }}</a></li>
<li><a href="{{url_for('about')}}?lang={{ _('code') }}">{{ _('About') }}</a></li>
<li><a id="switch-language" href="{{ _('switch_link') }}">
{{ _('switch_code') }}
</a></li>
@ -84,8 +84,8 @@
<!-- Scripts-->
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="/static/js/materialize.js"></script>
<script src="/static/js/wNumb.js"></script>
<script src="/static/js/result.js"></script>
<script src="/stark/static/js/materialize.js"></script>
<script src="/stark/static/js/wNumb.js"></script>
<script src="/stark/static/js/result.js"></script>
</body>
</html>

Loading…
Cancel
Save