I want to redirect any request which is not an api call to the index
method. All api urls start with "/api". Should I do this using mod_rewrite or can Flask handle this natively?
from flask import Flask
app = Flask(__name__, static_folder="public", static_url_path="")
@app.route("/", methods=["GET"])
def index():
return render_template("index.html")
@app.route("/api/some_resources", methods=["GET"])
def get_all():
pass
<VirtualHost *>
ServerName example.com
WSGIDaemonProcess my_app user=www-data group=www-data threads=5
WSGIScriptAlias / /var/www/my_app/my_app.wsgi
<Directory /var/www/my_app>
WSGIProcessGroup my_app
WSGIApplicationGroup %{GLOBAL}
WSGIScriptReloading On
Order deny,allow
Allow from all
</Directory>
</VirtualHost>