This repository contains the backend code for the error monitoring project.
This API uses the following framework and extensions:
- Quart - Quart is an ASGI Python microframework similar to Flask. Quart supports full asynchronous code.
- Quart-Schema - Quart-Schema is an extension for the Quart microframework. It allows validation of incoming and outgoing data (usually JSON) against a Python dataclass. Quart-Schema also generates swagger documenation so other developers can interact with the API with ease.
- Quart-CORS - Quart-CORS is an extension for the Quart microframework. It enables and controls Cross Origin Resource Sharing (CORS).
- Databases - The databases package provides a wrapper around the SQLAlchemy Core language and provides support for PostgreSQL, MySQL, and SQLite.
- Black - The black formatter formats code to the PEP 8 style guide.
-
Clone or download the respository
-
Open the repository in your terminal by using
cd
cd error-monitoring-api
Create a virtual environment to manage dependencies:
On Linux/MacOS:
python3 -m venv venv
On Windows using CMD:
C:\>C:\Python35\python -m venv venv
-
Activate the virtual environment
On Linux/MacOS:
source venv/bin/activate
On Windows using CMD:
C:\> venv\Scripts\activate.bat
-
Install the dependencies within the virtual environment:
pip install -r requirements.txt
-
Create a
.env
file within the root directory. -
Define the values for the environment variables, including the secret key and the database user's username and password:
SECRET_KEY=changethis POSTGRES_USER=postgres POSTGRES_PASSWORD=password POSTGRES_DATABASE=database QUART_ENV=development
-
Define the
QUART_APP
environment variable:On Linux/MacOS:
export QUART_APP=app:app
On Windows using CMD:
set QUART_APP=app:app
-
Run the app
quart run
- If everything was done correctly, you should see this output with no errors:
* Serving Quart app 'src' * Environment: development * Debug mode: True * Running on http://127.0.0.1:5000 (CTRL + C to quit) development
- Go to localhost:5000 in your browser. You should see "Hello World!" Congratulations!
All contributions are welcome, even small ones :) But please format your code by using this command before you make a pull request or contribution:
On Windows/MacOS/Linux:
black .
You can view documentation for this API by visiting localhost:5000/redocs or localhost:5000/docs
Check out the tasks on the Projects tab