diff --git a/mapiris/main.py b/mapiris/main.py index 9f0a3629cd174ca0ee484aeb1c2a82f73ffbe36a..3915c4561979a4a0a808494faf8dec7eeef63978 100644 --- a/mapiris/main.py +++ b/mapiris/main.py @@ -11,34 +11,13 @@ import os, json from mapiris import model app = Flask(__name__) -url = 'http://127.0.0.1:8080' +url = 'http://127.0.0.1:8081' @app.route('/', defaults={'page': None}) #@app.route('/<page>', methods=["GET", "POST"]) def index(page): - print(page) return render_template('index.html') - """ - if page is not None: - return render_template(page) - else: - return render_template('index.html') - """ - """ - if request.method == "POST": - if page is None: - return render_template('index.html') - # TODO remove the next lines - elif page.find('recommendation.html') > -1: # there is an argument POST - return render_template('recommendation.html') - elif page.find('clustering.html') > -1: # there is an argument POST - return render_template('clustering.html') - else: - return render_template(page) - else: # to avoid : Method Not Allowed The method is not allowed for the requested URL. - return render_template('index.html') - """ @app.route('/details-iris.html', methods=["GET"]) @@ -107,5 +86,5 @@ if __name__ == '__main__': webbrowser.open_new(url) app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0 # do not cache files, especially static files such as JS app.secret_key = 's3k_5Et#fL45k_#ranD0m-(StuF7)' - app.run(port=8080) # debug = True + app.run(port=8081) # debug = True diff --git a/mapiris/model.py b/mapiris/model.py index 81397683297a5783ee759682e5ecd0a88895edfb..cc208184642efe8856138dd7cd21165df8ea8f83 100644 --- a/mapiris/model.py +++ b/mapiris/model.py @@ -4,17 +4,20 @@ # model.py: methods for getting data from MongoDB (using mongiris) and transforming it # ============================================================================= -from mongiris import Mongiris -import re, json +from mongiris.main import Mongiris +import re +import json # connection to the IRIS collection in MongoDB db = Mongiris() -iris_collection = db.iris_collection +iris_collection = db.collection_iris db.init_connection() json_iris_indicator_code_to_label = 'static/data/dictionnaire-indicateurs.json' + def get_iris_for_polygon(lat1, lng1, lat2, lng2): - polygon = db.convert_geojson_box_to_polygon(lng1, lat1, lng2, lat2) + #polygon = db.convert_geojson_box_to_polygon(lng1, lat1, lng2, lat2) + polygon = Mongiris.convert_geojson_box_to_polygon(lng1, lat1, lng2, lat2) #iris = db.geo_within(iris_collection, polygon) iris = db.intersect(iris_collection, polygon) return iris diff --git a/mapiris/templates/header.html b/mapiris/templates/header.html index 8a8e2ebd2194752d9370760b9729147f4d49d500..3cba80fe4f05b9eea375f4f361e56c305ee1093e 100644 --- a/mapiris/templates/header.html +++ b/mapiris/templates/header.html @@ -1,5 +1,5 @@ <header class="mb-3"> - <h1><img src="{{url_for('static', filename='img/favicon.png')}}"> mapiris</h1> + <h1><a href="/"><img src="{{url_for('static', filename='img/favicon.png')}}"></a> mapiris</h1> <em>Un outil de visualisation des IRIS</em> <hr> </header> \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 58a36ef6d9a5344c62d1d1e99c4483ccccbef642..ad4581beb5e9746825aa800d67970a8240d20df6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = mapiris -version = 0.1 +version = 0.12 description = This package aims at searching and printing IRIS on a map. author = Fabien Duchateau author_email = fabien.duchateau@univ-lyon1.fr @@ -15,9 +15,9 @@ include_package_data = True zip_safe = False install_requires = flask >= 1.0.2 - mongiris >= 0.21 + mongiris >= 0.3 dependency_links = - git+https://fduchate@gitlab.liris.cnrs.fr/fduchate/mongiris.git#egg=mongiris-0.21 + git+https://fduchate@gitlab.liris.cnrs.fr/fduchate/mongiris.git#egg=mongiris-0.3 #[options.packages.find] #exclude = @@ -27,9 +27,9 @@ dependency_links = [options.package_data] # package_data is ignored when a MANIFEST.in is provided . = README.md, -mapiris/static = vizliris/static/** -mapiris/templates = vizliris/templates/* -mapiris/data = vizliris/data/** +mapiris/static = mapiris/static/** +mapiris/templates = mapiris/templates/* +mapiris/data = mapiris/data/** [bdist_wheel] universal = 1