Skip to main content

A simple Django app to make the RESTFULL APIs

Project description

===== django-api-base

django-api-base is simple django package that can be used to build RESTFUL web api's with django

Detailed documentation is in the "docs" directory.

Quick start

  1. Add "django_api_base" to your INSTALLED_APPS setting like this::

    #!python
    
    INSTALLED_APPS = [
        ...
        'django_api_base',
    ]
    
    
    #Django-api-base settings
    API_TESTING = True
    
    ACCESS_TOKEN_EXPIRE_DAYS = 15
    
    FROM_EMAIL = ""
    
    BUCKET_URL = ""
    
    MIDDLEWARE_CLASSES = [
    ...
    'django_api_base.middleware.api_exception.APIExceptionHandler'  # APIExceptionHandler middleware should be added here
    'django_api_base.middleware.logging_middleware.LogAllServerCalls'  # For logging all server request calls info
    'django_api_base.middleware.logging_middleware.LogAllExceptionErrors'  # For logging all exceptions occured
    ]
    
    # Logging settings
    LOGGING = {
        'version': 1,
        'disable_existing_loggers': True,
        'formatters': {
            'verbose': {
                'format': "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
                'datefmt': "%d/%b/%Y %H:%M:%S"
            },
        },
        'handlers': {
            'access': {
                'level': 'INFO',
                'class': 'logging.FileHandler',
                'filename': 'access.log',
                'formatter': 'verbose'
            },
            'error': {
                'level': 'ERROR',
                'class': 'logging.FileHandler',
                'filename': 'error.log',
                'formatter': 'verbose'
            },
            'debug': {
                'level': 'DEBUG',
                'class': 'logging.FileHandler',
                'filename': 'debug.log',
                'formatter': 'verbose'
            },
        },
        'loggers': {
            'info': {
                'handlers': ['access'],
                'level': 'INFO',
            },
            'error': {
                'handlers': ['error'],
                'level': 'ERROR',
            },
            'debug': {
                'handlers': ['debug'],
                'level': 'DEBUG',
            },
        }
    }
    
  2. Run python manage.py migrate to create the UserProfile model which can be used as a user profile model in your django project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Django-api-base-1.1.0.tar.gz (8.5 kB view details)

Uploaded Source

File details

Details for the file Django-api-base-1.1.0.tar.gz.

File metadata

  • Download URL: Django-api-base-1.1.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.9

File hashes

Hashes for Django-api-base-1.1.0.tar.gz
Algorithm Hash digest
SHA256 92db84c7c0c8db8ca33ffda49019200cd644d8482713b73561e470d97ce8ff9f
MD5 29e661d6de979711602bdd9eac51a639
BLAKE2b-256 bae4c97d2590ba116a6d6bbdd2f9c45f9e0481dd2a67cd8acee73e86244e848a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page