app export view set not found
Closed this issue · 4 comments
Hi Emma:
i am having this error
python manage.py export --adapter_name EmberAdapter prodcuts
Exporting prodcuts using export_app.adapters.EmberAdapter
CommandError: No viewset found for prodcuts
when i try to run this the export on my cmd , i already set things i need at both side can you pin point what the problem of mine ?
here is the github of mine https://github.com/differentMonster/air-pack-2
Hi :-)
I am looking at your code and I don't see any Product
model nor ViewSet
.
A good rule of thumb is that you can export anything that shows up in your list of api's (at /api/back/
if it was not commented)
You may want to start with the example code from here: https://drf-schema-adapter.readthedocs.io/en/latest/cookbooks/basics/endpoints/
I hope this help.
yeah i got it worked ^^ , but i still some question about it, hope you dont mind if i ask here
1.the setting EXPORTER_ROUTER_PATH = 'djember_sample.api_urls.router' and register my viewset there,
router.registerViewSet(r'userinfos', UserViewSet) it work , but i want to isolation all project register on they app folder , so i make a api_url in the app folder and register it , it wont work.
so do we have to register all the app at the djember_sample api_urls ? i am confusing on this part
sorry for the slow reply, these past few weeks have been quite busy.
EXPORT_ROUTER_PATH
should contain the path to your main router. from the repo you shared, that would be 'api.urls.router'
registerViewSet
is used to register existing DRF ViewSet
's, if you use endpoints.py
files in your application with @register
decorators on your Endpoint
's the url will automatically include the app name.
The registration the @register
decorator will do everything for you and you won't need to use router.register
or router.registerViewSet
in your urls. It works exactly like when you are creating admin classes in an admin.py
file.
This section of the documentation might help you a bit more: https://drf-schema-adapter.readthedocs.io/en/latest/cookbooks/basics/endpoints/#creating-endpoints-from-models
Closing this as it seems to be resolved.
Feel free to re-open if it's not