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-0.8.tar.gz (6.6 kB view hashes)

Uploaded Source

Supported by

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