API (not only) for Ella-Hope, brand new Ella/Django admin
- install ella-hub
# if you work with virtualenv source env_project/bin/activate git clone git://github.com/SanomaCZ/ella-hub.git cd ella-hub [sudo] pip install -r requirements.txt [sudo] python setup.py install
- include ella-hub to settings.py in your ella project
MIDDLEWARE_CLASSES = ( ... 'django.contrib.auth.middleware.AuthenticationMiddleware', ... # neccessary for ella-hope with different origin 'ella_hub.utils.middleware.CrossDomainAccessMiddleware', ) INSTALLED_APPS = ( ... 'tastypie', ... 'ella.core', 'ella.articles', 'ella.photos', ... 'ella_hub', ... ) # API resources RESOURCE_MODULES = ( 'ella_hub.ella_resources', # only when you are using ella-galleries application 'ella_hub.extern_resources.ella_galleries_resources', # only when you are using ella-wikipages application 'ella_hub.extern_resources.ella_wikipages_resources', # only when you are using django-taggit application 'ella_hub.extern_resources.taggit_resources', # only when you are using daz-taggit application 'ella_hub.extern_resources.daz_taggit_resources', ) # Needed by object_permissions app (django-object-permissions) AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', )
- route resource URLs in urls.py
# admin API setup from ella_hub.api import EllaHubApi from ella_hub.utils.workflow import init_ella_workflow admin_api = EllaHubApi('admin-api') admin_api.register_resources(resources=admin_api.collect_resources()) urlpatterns = patterns('', ... # /admin-api/[<resource_name>/[<id>/]] url(r'^', include(admin_api.urls)), )
- update database of your project
python manage.py syncdb python manage.py init_ella_workflow
Master branch: |
---|