Installation
Python version
- Audoma supports and was tested for the following versions of python:
python 3.7
python 3.8
python 3.9
Dependencies
- These distributions will be installed automatically when installing audoma (if you don’t have them installed already):
exrex - a regular expression generator
django-phonenumber-field - a phone number field package for django
django-macaddress - a mac address field package for django
phonenumbers - python package for parsing phone numbers - we use it for generating examples of phone numbers
django-filter - django package that allows to filter down a queryset based on a model’s fields
django-money - django package that allows to store money and currency values in the database
lorem - generator for random text that looks like Latin.
drf-extra-fields - this package provides additional serializer fields, those fields are equivalent of django Postgres specific fields
Install Audoma
Using pip:
$ pip install audoma
Audoma initial configuration
After successful installation, set AudomaAutoSchema as a default schema class for your Django Rest Framework project:
REST_FRAMEWORK = {
# YOUR SETTINGS
'DEFAULT_SCHEMA_CLASS': 'audoma.openapi.AudomaAutoSchema',
}
Audoma allows you to add path prefixes that should be included in schema exclusively. All you need to do is declare a variable SCHEMA_PATTERN_PREFIX` in your project’s settings.py file and add preprocessing function preprocess_include_path_format as preprocessing hook in SPECTACULAR_SETTINGS dictionary` as in the example below.
SCHEMA_PATTERN_PREFIX = 'api'
SPECTACULAR_SETTINGS = {
...
'PREPROCESSING_HOOKS': ['audoma.hooks.preprocess_include_path_format'],
# OTHER SETTINGS
}