BurkovBA / django-rest-framework-mongoengine-example

django-rest-framework-mongoengine-example
83 stars 45 forks source link

get_api_root_view() got an unexpected keyword argument 'api_urls' #3

Open G-linch opened 7 years ago

G-linch commented 7 years ago

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?

franciscbalint commented 7 years ago

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

iamanoopmk commented 7 years ago

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

BurkovBA commented 7 years ago

@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.

iamanoopmk commented 7 years ago

Even the Django needs to the older version?

BurkovBA commented 7 years ago

@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. =)

iamanoopmk commented 7 years ago

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

iamanoopmk commented 7 years ago

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

BurkovBA commented 7 years ago

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

iamanoopmk commented 7 years ago

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