Your questions are quite relevant, and I will try to answer them for you.
- Can a Python web app be created in Visual Studio? Yes, you can create a Python web app in Visual Studio. Visual Studio supports Python development through the Python Development workload. You can use frameworks like Flask or Django to build your web app.
- What needs to be done to provide a callable API in it? You can use Flask or Django REST framework to create a callable API in your Python web app. These frameworks allow you to define routes and endpoints similar to ASP.NET controllers. For example, in Flask, you can use decorators to define your API endpoints:
from flask import Flask, jsonify app = Flask(__name__) @app.route('/api/data', methods=['GET']) def get_data(): return jsonify({'key': 'value'}) if __name__ == '__main__': app.run()
- Can we configure these two app servers in Azure so this app can only be called by the Blazor app? Yes, you can configure your Azure App Services to restrict access. One way to achieve this is by using Azure API Management or configuring IP restrictions. You can whitelist the IP address of your Blazor app’s server so that only requests from this IP are allowed.
- Am I missing anything? Ensure that your Python web app is properly secured, even if it’s only being called by your Blazor app. Consider using HTTPS and validating incoming requests. Additionally, if your Blazor app and Python API are hosted on different domains, you might want to handle potential cross-origin resource sharing (CORS) issues.
If this answers your question, please click Accept Answer and Yes if this answer was helpful. Doing so would help other community members with similar issues identify the solution. I highly appreciate your contribution to the community.