From 39fb05694b0730cec042731f6cc32ed08ce41399 Mon Sep 17 00:00:00 2001 From: ='fauz <='fauzgabriel@gmail.com> Date: Thu, 3 Jul 2025 03:06:18 +0700 Subject: [PATCH] ungke --- app/__init__.py | 6 ++++++ app/routes.py | 4 ---- templates/index.html | 2 +- templates/map.html | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index e63f8bb..e80e0de 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -8,6 +8,12 @@ def create_app(): template_path = os.path.join(base_dir, '..', 'templates') static_path = os.path.join(base_dir, '..','static') app = Flask(__name__, template_folder=template_path, static_folder=static_path) + + app.config['BASE_URL'] = os.environ.get('BASE_URL', 'http://192.168.91.101:5000') + @app.context_processor + def inject_config(): + return dict(base_url=app.config['BASE_URL']) + CORS(app, resources={r"/api/*": {"origins": "*"}}) app.register_blueprint(main) return app \ No newline at end of file diff --git a/app/routes.py b/app/routes.py index 9c0d274..522a7eb 100644 --- a/app/routes.py +++ b/app/routes.py @@ -41,10 +41,6 @@ def get_total_dana_by_level(level,kode): #======================================================== # MAIN ROUTE #======================================================== -@main.context_processor -def inject_config(): - return dict(api_base_url=main.config['API_BASE_URL']) - @main.route('/') def index(): with get_connection() as conn: diff --git a/templates/index.html b/templates/index.html index e328a49..df77500 100644 --- a/templates/index.html +++ b/templates/index.html @@ -212,7 +212,7 @@ map.setMinZoom(optimalZoom);