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.

Files for Django-api-base, version 0.10.2
Filename, size & hash File type Python version Upload date
Django-api-base-0.10.2.tar.gz (7.9 kB) View hashes Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page