django-rest-framework-mongoengine-example icon indicating copy to clipboard operation
django-rest-framework-mongoengine-example copied to clipboard

get_api_root_view() got an unexpected keyword argument 'api_urls'

Open G-linch opened this issue 7 years ago • 9 comments

hi,guys:

i got a error:

TypeError: get_api_root_view() got an unexpected keyword argument 'api_urls'

i check the get_api_root_views(),as the error.no parameter

this is in cmd:

  url(r'^api/', include(router.urls, namespace='api')),
  File "C:\Python34\rest1\lib\site-packages\rest_framework\routers.py", line 82, in urls
    self._urls = self.get_urls()
  File "C:\Python34\rest1\project\project\routers.py", line 30, in get_urls
    urls = super(HybridRouter, self).get_urls()
  File "C:\Python34\rest1\lib\site-packages\rest_framework\routers.py", line 378, in get_urls
    view = self.get_api_root_view(api_urls=urls)
TypeError: get_api_root_view() got an unexpected keyword argument 'api_urls'

how can i fixed it?

G-linch avatar Apr 08 '17 16:04 G-linch

Check if all versions are correct for drf, drfm, mongoengine, django. Some versions are not compatible. If you still have problems reply with the output from: pip list and project routers.py

franciscbalint avatar Apr 08 '17 22:04 franciscbalint

I was following the example given below

https://github.com/BurkovBA/django-rest-framework-mongoengine-example

Here is my output from pip list

Django (1.11.3) django-rest-framework-mongoengine (3.3.1) djangorestframework (3.6.3) mongoengine (0.9.0) pip (9.0.1) pkg-resources (0.0.0) pymongo (2.7) pytz (2017.2) setuptools (36.0.1) wheel (0.30.0a0)

routers.py is the same as the one in that example

I have created my own models and followed the example to do so. I too am getting this same error when I register the urls

iamanoopmk avatar Jul 12 '17 10:07 iamanoopmk

@iamanoopmk Hi! You installed the latest dependencies, but this project so far was tested with somewhat older versions: https://github.com/BurkovBA/django-rest-framework-mongoengine-example/blob/master/requirements.txt.

Just use pip install -r requirements.txt.

BurkovBA avatar Jul 12 '17 10:07 BurkovBA

Even the Django needs to the older version?

iamanoopmk avatar Jul 12 '17 10:07 iamanoopmk

@iamanoopmk In reality, no, I think not, you can try 1.11. But I haven't tested the newer one, so can't guarantee. Try it, if it works - I can update the requirements. =)

BurkovBA avatar Jul 12 '17 10:07 BurkovBA

Thank you... I will try and get back to you

iamanoopmk avatar Jul 12 '17 11:07 iamanoopmk

@BurkovBA Thanks for the help. It turns out, higher Django version gives a different error. version 1.9 works though.

iamanoopmk avatar Jul 12 '17 11:07 iamanoopmk

@iamanoopmk Sorry about lagging updates. Unfortunately, I'm totally out of time recently.

BurkovBA avatar Jul 12 '17 11:07 BurkovBA

@BurkovBA No issues. Thanks for this library and the quick response.

iamanoopmk avatar Jul 12 '17 11:07 iamanoopmk