https://github.com/kingsdigitallab/django-geonames-place
Application to access and store Geonames Places in Django projects
https://github.com/kingsdigitallab/django-geonames-place
django geocoding reusable
Last synced: about 1 year ago
JSON representation
Application to access and store Geonames Places in Django projects
- Host: GitHub
- URL: https://github.com/kingsdigitallab/django-geonames-place
- Owner: kingsdigitallab
- License: mit
- Created: 2018-11-15T14:36:33.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-26T20:38:48.000Z (over 3 years ago)
- Last Synced: 2025-03-11T19:45:58.369Z (over 1 year ago)
- Topics: django, geocoding, reusable
- Language: Python
- Size: 43.9 KB
- Stars: 4
- Watchers: 5
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- Changelog: HISTORY.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
Awesome Lists containing this project
README
=====================
Django Geonames Place
=====================
.. image:: https://travis-ci.org/kingsdigitallab/django-geonames-place.svg?branch=master
:target: https://travis-ci.org/kingsdigitallab/django-geonames-place
.. image:: https://codecov.io/gh/kingsdigitallab/django-geonames-place/branch/master/graph/badge.svg
:target: https://codecov.io/gh/kingsdigitallab/django-geonames-place
Application to access Geonames Places directly from Django.
The application can create places by using a geonames id or by using a search
address.
This application depends on the very useful
`Python Geocoder `_ library.
Documentation
-------------
The full documentation is at https://django-geonames-place.readthedocs.io.
Quickstart
----------
Install Django Geonames Place::
pip install django-geonames-place
Add it to your `INSTALLED_APPS`:
.. code-block:: python
INSTALLED_APPS = (
...
'geonames_place.apps.GeonamesPlaceConfig',
...
)
Add the settings `GEONAMES_KEY` and `GEONAMES_MAX_RESULTS`. The `GEONAMES_KEY`
is your Geoname API key, and the `GEONAMES_MAX_RESULTS` is used to set the
maximum number of results when searching Geonames.
.. code-block:: python
GEONAMES_KEY = ''
GEONAMES_MAX_RESULTS = 10
To reference Geonames Place in your models:
.. code-block:: python
from django.db import models
from geonames_place.models import Place
class MyModel(models.Model):
...
place = models.ForeignKey(Place, on_delete=models.CASCADE)
...
Running Tests
-------------
Does the code actually work?
::
export GEONAMES_KEY=
source /bin/activate
(myenv) $ pip install tox
(myenv) $ tox
Credits
-------
Tools used in rendering this package:
* Cookiecutter_
* `cookiecutter-djangopackage`_
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage