This commit is contained in:
='fauz 2025-07-03 03:06:18 +07:00
parent b21ed65133
commit 39fb05694b
4 changed files with 8 additions and 6 deletions

View File

@ -8,6 +8,12 @@ def create_app():
template_path = os.path.join(base_dir, '..', 'templates') template_path = os.path.join(base_dir, '..', 'templates')
static_path = os.path.join(base_dir, '..','static') static_path = os.path.join(base_dir, '..','static')
app = Flask(__name__, template_folder=template_path, static_folder=static_path) 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": "*"}}) CORS(app, resources={r"/api/*": {"origins": "*"}})
app.register_blueprint(main) app.register_blueprint(main)
return app return app

View File

@ -41,10 +41,6 @@ def get_total_dana_by_level(level,kode):
#======================================================== #========================================================
# MAIN ROUTE # MAIN ROUTE
#======================================================== #========================================================
@main.context_processor
def inject_config():
return dict(api_base_url=main.config['API_BASE_URL'])
@main.route('/') @main.route('/')
def index(): def index():
with get_connection() as conn: with get_connection() as conn:

View File

@ -212,7 +212,7 @@
map.setMinZoom(optimalZoom); map.setMinZoom(optimalZoom);
</script> </script>
<script> <script>
const baseUrl = "{{ api_base_url }}"; const baseUrl = "{{ base_url }}";
let currentLayer = null; let currentLayer = null;
let currentState = { let currentState = {
level: null, level: null,

View File

@ -208,7 +208,7 @@
map.setMinZoom(optimalZoom); map.setMinZoom(optimalZoom);
</script> </script>
<script> <script>
const baseUrl = "{{ api_base_url }}"; const baseUrl = "{{ base_url }}";
let currentLayer = null; let currentLayer = null;
let currentState = { let currentState = {
level: null, level: null,