Not sure why, but moving path("integrations/", 
include("integrations.urls")), above the "" slash seems to have solved the 
problem.

On Friday, June 17, 2022 at 5:45:19 PM UTC-5 Mike Kilmer wrote:

> This app is set up to create webhooks and receive requests, however the 
> routing has broken and the requests are getting a 404.
>
> The path looks like this:
>
>
> http://127.0.0.1:8000/integrations/dc3509ac-1aa8-4c9a-a439-904342d885cd/order
>
> The Stack Track/Routing:
>
> Using the URLconf defined in fulfill.urls, Django tried these URL 
> patterns, in this order:
>
>    1. baton/
>    2. [name='index']
>    3. etc...
>    4. integrations/request/
>    5. reports/clientreport/
>    6. 
> ^(?P<app_label>auth|sites|account|socialaccount|users|core|integrations|reports)/$
>  
>    [name='app_list']
>    7. (?P<url>.*)$
>
> The current path, integrations/dc3509ac-1aa8-4c9a-a439-904342d885cd/order, 
> matched the last one.
>
> My URL setup is like this:
> urlpatterns = [
>     path("baton/", include("baton.urls")),
>     # Be sure "baton/" is at the beginning of the list, before "".
>     path("", admin.site.urls),
>     path('accounts/', include('allauth.urls')),
>     path("integrations/", include("integrations.urls")),
>     path("queryfilter/", include("core.urls")),
>     path("docs/", include("docs.urls")),
>     path(
>         "favicon.ico", 
> RedirectView.as_view(url=staticfiles_storage.url("favicon.ico"))
>     ),
> ]
>
> With integrations.urls like this:
>
> urlpatterns = [
>   path(
>     "<uuid:integration_uuid>/order",
>       incoming_order,
>       name="incoming-order",
>     ),
> ]
>
>
> The incoming_order method looks like this:
>
> @csrf_exempt
> @require_http_methods(["POST"])
> def incoming_order(request, integration_uuid):
>     headers = request.headers
>     request_body = request.body.decode("utf-8")
>     log = Request.objects.create(
>         url=request.build_absolute_uri(), body=request_body, 
> headers=dict(headers)
>     )
>
>     log.process(integration_uuid)
>
>     return JsonResponse({"status": "ok"})
>
> Any suggestions?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c23ab998-6331-44a0-ace2-a2f273fc36d5n%40googlegroups.com.

Reply via email to