![flask-wasmer package icon](/_next/image?url=https%3A%2F%2Fcdn.wasmer.io%2FCACHE%2Fimages%2Ficon%2Fpackage%2F7f6efad5-9d23-4f12-9960-6e76a4262258_default_icon%2Fb854310b054e759077ec1fc05ceceeb6.png&w=96&q=75)
![flask-wasmer package icon](/_next/image?url=https%3A%2F%2Fcdn.wasmer.io%2FCACHE%2Fimages%2Ficon%2Fpackage%2F7f6efad5-9d23-4f12-9960-6e76a4262258_default_icon%2Fb854310b054e759077ec1fc05ceceeb6.png&w=96&q=75)
This is a simple Flask Web Server template
Usage
First, create a local virtual environment:
python3 -m venv .env
source .env/bin/activate
Install the dependencies with:
pip install Flask
Then, you can run the Flask app (src/main.py
) with Python:
$ python src/main.py
* Serving Flask app '/src/main'
* Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:5000
Press CTRL+C to quit
You can run the Flask example using Wasmer (check out the install guide):
wasmer run thibaultleouay/flask-wasmer --net
Note: you may need to update wasmer.toml
filesystem, to point ot the right path for the environment depending on your Python version (currently using ./.env/lib/python3.9
).
[!TIP] You can also run
wasmer run . --net
in the root of this repo
Open http://localhost:3000 with your browser to see the Flask application.
Deploy on Wasmer Edge
The easiest way to deploy your Flask app is to use the Wasmer Edge.
Live example: https://wasmer-python-flask-server-worker.wasmer.app
Run this commmand to deploy to Wasmer Edge:
wasmer deploy
[!NOTE] You will need to change the namespace in
wasmer.toml
to your own namespace and app name inapp.yaml
to your own app name.