Skip to main content

Little django application that exposes the sepomex database in a RESTful way.

Project description

Little django application that exposes the sepomex database in a RESTful way.

https://api.travis-ci.org/slackmart/tastypie-sepomex.svg?branch=master https://coveralls.io/repos/slackmart/tastypie-sepomex/badge.svg?branch=master&service=github

Installation

$ pip install django-tastypie-sepomex

Configuration

  1. Once installed, you must add sepomex to your INSTALLED_APPS

INSTALLED_APPS += ['sepomex']
  1. Apply migrate command to add the sepomex models to your database.

$ python manage.py migrate sepomex
  1. The sepomex data is provided in a file called sepomex-data.tar.gz, you need to extract the content.

$ tar xvf sepomex-data.tar.gz
  1. Populate your sepomex models

$ python manage.py loadsepomex

This command will call the loadmxstates and loadmxmunicipalities commands. It finally will fill the sepomex_mxasentamiento table to complete the process.

Run your server

$ python manage.py runserver

… and use the endpoints provided

Get the list of states

There are 32 states, so we pass that as a query string.

$ curl localhost:8000/api/v1/mxestado/?limit=32

List first 20 municipalities for Coahuila

Coahuila’s id is 5. If not specified, the limit objects per query is 20

$ curl localhost:8000/api/v1/mxmunicipio/?mx_estado__id=5

Activate sepomex logger

Example of LOGGING dict in settings.py. You might have more loggers.

LOGGING = {
    'version': 1.0,
    'disable_existing_loggers': False,
    'handlers': {
        'console': {
            'class': 'logging.StreamHandler'
        }
    },
    'loggers': {
        'sepomex': {
            'handlers': ['console'],
            'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
        },
        # Your loggers here
    }
}

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-tastypie-sepomex-0.1.0.tar.gz (5.0 kB view details)

Uploaded Source

File details

Details for the file django-tastypie-sepomex-0.1.0.tar.gz.

File metadata

File hashes

Hashes for django-tastypie-sepomex-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d4d77774c833bcf5a06f0c5de67b58b9cc758d182312f89007b03e02d62be724
MD5 51358f672e2b1fdae049a76d592cdcc1
BLAKE2b-256 3d7cb94c802902fb15ebf5e5854864b03093ced401eefffa1675a00a2996af29

See more details on using hashes here.

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