-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Router with basename is already registered #658
Comments
At what point are you getting this error? I can't reproduce this on any supported version of Django. |
Running Python 3.10, I clone the donation-tracker, install it with the edit flag, then I install django 5.0 and create the basic project as in the readme. I do the installs in donation-tracker and set up the files just as in the guide, with analytics turned off. Then I run python manage.py migrate and python manage.py runserver - this is when I get the error. Nothing else, I'm following the guide almost 1:1 except for the migration and disabling analytics. |
Just reconfirmed: Tried this with both Django 4.2 and 5.0, Python 3.10 and 3.12, all of them have the same problem and these two routes always break them, commenting them out builds the app, although I'm probably missing important things there. Full log below:
|
My guess is that something about your setup is causing that file to get imported twice. If you stick a print call right before that line do you see it in the logs more than once? |
Yes, it logs twice. Not really sure where I could be doing anything wrong as I'm just following the instructions. But it also doesn't get through the register even for the first time, which is weird. |
Update: I found out the reason why it logged twice. When manage.py is executed normally, it has an autoreloader function. Running it with However, it will still crash for those two routes I mentioned regardless of this. The issue must be somewhere in the routes setup itself. Update: I can now 100% confirm that the issue happens within the event_nested_route. |
I was able to get this to occur, but only on Windows. Not sure yet why it would be different there. I'll take a look when I can. Edit: It's something they changed in DRF. Looks like 3.15.0, because this autobump PR fails, and I hadn't had a chance to take a look at it yet: Relevant issue from DRF: encode/django-rest-framework#8438 Workaround for now is to install DRF 3.14.0. |
Had the same issue on Debian too. Looks like it works with DRF 3.14 though, thanks. |
My other machines still had DRF 3.14 in their relevant environments so that's why it still worked there, since pip doesn't update existing packages unless you explicitly tell it to. My Windows machine was a completely fresh install, though, so it picked up 3.15 and broke. |
It seems like some routes (specifically these in /tracker/api/urls.py)
have some problems as I'm constantly running into a django.core.exceptions.ImproperlyConfigured exception with comment: Router with basename "bid" is already registered. Please provide a unique basename for viewset "<class 'tracker.api.views.bids.BidViewSet'>"
Now this seems to go away if you just comment the lines and most parts of the tracker seem to work, but unfortunately, this is a consistently reproducible issue that I couldn't find a way around.
The text was updated successfully, but these errors were encountered: