Closed abdulwahid24 closed 10 years ago
Hi,
We will need the traceback of the 500 to be able to help you ;)
Here is the complete stack trace.
Environment:
Request Method: GET Request URL: http://localhost:8000/api/v1/doc/resources/?api_key=special-key
Django Version: 1.7b1 Python Version: 2.7.4 Installed Applications: ('django.contrib.admin', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'mongoengine.django.mongo_auth', 'tastypie', 'tastypie_mongoengine', 'tastypie_swagger') Installed Middleware: ('django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware')
Traceback: File "/home/synerzip/educator-env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
Exception Type: AttributeError at /api/v1/doc/resources/ Exception Value: 'Api' object has no attribute 'rsplit'
Hey, i resolved it finally,
I was passing Api instance directly to tastypie_api_module but it expect complete path to this instance.
This was my old code with error. url(r'api/v1/doc/', include('tastypie_swagger.urls', namespace='tastypie_swagger'),kwargs={'tastypie_api_module':v1_api, 'namespace':'tastypie_swagger'}),
And resolved code is url(r'api/v1/doc/', include('tastypie_swagger.urls', namespace='tastypie_swagger'),kwargs={'tastypie_api_module':'mysite.urls.v1_api', 'namespace':'tastypie_swagger'}),
Thanks alot... Awesome work done by you guys....really appreciated :)
Glad you found the issue, will try to add a more meaningful message there.
I have trouble while displaying api docs and i followed every single steps mentioned on http://django-tastypie-swagger.readthedocs.org/en/latest/. But failed to load resource api doc. Need your help to fix this.
Here are my details
===========Packages=============== Django - 1.7b1 Python - 2.7.4 django-tastypie-mongoengine - 0.4.5 - active django-tastypie-swagger - 0.1.3 - active django-tastypie - 0.11.0 mongoengine - 0.8.7
================api.py========================= from mongoengine import * from mongoengine.django.auth import User
class Profile(Document):
==============urls.py=========================== from django.conf.urls import patterns, include, url from django.contrib import admin
from tastypie.api import Api from users.api import UserResource, ProfileResource
v1_api = Api(api_name='v1') v1_api.register(UserResource()) v1_api.register(ProfileResource())
admin.autodiscover()
urlpatterns = patterns('',
Examples:
)
====================setttings.py================= TASTYPIE_API_MODULE = 'educator.urls.v1_api'
Below is what i am getting while hitting the url "http://localhost:8000/api/v1/doc/". 500 : INTERNAL SERVER ERROR /api/v1/doc/resources/?api_key=special-key