Introduction¶
This is the documentation for baguette
, a micro web
framework for ASGI servers.
Prerequisites¶
Python 3.6 or higher is required.
Installing¶
Install baguette
with pip:
python3 -m pip install -U baguette
py -3 -m pip install -U baguette
Installing ASGI server¶
You also need an ASGI server to run your app like uvicorn
or hypercorn. To install uvicorn
directly with baguette, you can add the uvicorn
argument:
python3 -m pip install -U baguette[uvicorn]
py -3 -m pip install -U baguette[uvicorn]
You can also install it with pip:
python3 -m pip install -U uvicorn[standard]
py -3 -m pip install -U uvicorn[standard]
Virtual Environments¶
Sometimes you want to keep libraries from polluting system installs or use a different version of libraries than the ones installed on the system. You might also not have permissions to install libraries system-wide. For this purpose, the standard library as of Python 3.3 comes with a concept called “Virtual Environment”s to help maintain these separate versions.
A more in-depth tutorial is found on Virtual Environments and Packages.
However, for the quick and dirty:
Go to your project’s working directory:
cd your-website-dir
cd your-website-dir
Create a virtual environment:
python3 -m venv venv
py -3 -m venv venv
Activate the virtual environment:
source venv/bin/activate
venv\Scripts\activate.bat
Use pip like usual:
pip install -U baguette
pip install -U baguette
Congratulations. You now have a virtual environment all set up. You can start to code, learn more in the Quickstart.