chore: Replace reprecated alias django.conf.urls.urls()
Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2709>
This commit is contained in:
parent
0fd0192b37
commit
f1f6ef43ad
|
@ -1,7 +1,7 @@
|
|||
from channels.auth import AuthMiddlewareStack
|
||||
from channels.routing import ProtocolTypeRouter, URLRouter
|
||||
from django.conf.urls import url
|
||||
from django.core.asgi import get_asgi_application
|
||||
from django.urls import re_path
|
||||
|
||||
from funkwhale_api.instance import consumers
|
||||
|
||||
|
@ -10,7 +10,12 @@ application = ProtocolTypeRouter(
|
|||
# Empty for now (http->django views is added by default)
|
||||
"websocket": AuthMiddlewareStack(
|
||||
URLRouter(
|
||||
[url("^api/v1/activity$", consumers.InstanceActivityConsumer.as_asgi())]
|
||||
[
|
||||
re_path(
|
||||
"^api/v1/activity$",
|
||||
consumers.InstanceActivityConsumer.as_asgi(),
|
||||
)
|
||||
]
|
||||
)
|
||||
),
|
||||
"http": get_asgi_application(),
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from django.conf import settings
|
||||
from django.conf.urls import url
|
||||
from django.conf.urls.static import static
|
||||
from django.urls import include, path
|
||||
from django.urls import include, path, re_path
|
||||
from django.views import defaults as default_views
|
||||
|
||||
from config import plugins
|
||||
|
@ -10,34 +9,34 @@ from funkwhale_api.common import admin
|
|||
plugins_patterns = plugins.trigger_filter(plugins.URLS, [], enabled=True)
|
||||
|
||||
api_patterns = [
|
||||
url("v1/", include("config.urls.api")),
|
||||
url("v2/", include("config.urls.api_v2")),
|
||||
url("subsonic/", include("config.urls.subsonic")),
|
||||
re_path("v1/", include("config.urls.api")),
|
||||
re_path("v2/", include("config.urls.api_v2")),
|
||||
re_path("subsonic/", include("config.urls.subsonic")),
|
||||
]
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
# Django Admin, use {% url 'admin:index' %}
|
||||
url(settings.ADMIN_URL, admin.site.urls),
|
||||
url(r"^api/", include((api_patterns, "api"), namespace="api")),
|
||||
url(
|
||||
re_path(settings.ADMIN_URL, admin.site.urls),
|
||||
re_path(r"^api/", include((api_patterns, "api"), namespace="api")),
|
||||
re_path(
|
||||
r"^",
|
||||
include(
|
||||
("funkwhale_api.federation.urls", "federation"), namespace="federation"
|
||||
),
|
||||
),
|
||||
url(r"^api/v1/auth/", include("funkwhale_api.users.rest_auth_urls")),
|
||||
url(r"^accounts/", include("allauth.urls")),
|
||||
re_path(r"^api/v1/auth/", include("funkwhale_api.users.rest_auth_urls")),
|
||||
re_path(r"^accounts/", include("allauth.urls")),
|
||||
] + plugins_patterns
|
||||
|
||||
if settings.DEBUG:
|
||||
# This allows the error pages to be debugged during development, just visit
|
||||
# these url in browser to see how these error pages look like.
|
||||
urlpatterns += [
|
||||
url(r"^400/$", default_views.bad_request),
|
||||
url(r"^403/$", default_views.permission_denied),
|
||||
url(r"^404/$", default_views.page_not_found),
|
||||
url(r"^500/$", default_views.server_error),
|
||||
re_path(r"^400/$", default_views.bad_request),
|
||||
re_path(r"^403/$", default_views.permission_denied),
|
||||
re_path(r"^404/$", default_views.page_not_found),
|
||||
re_path(r"^500/$", default_views.server_error),
|
||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
if "debug_toolbar" in settings.INSTALLED_APPS:
|
||||
|
@ -49,5 +48,5 @@ if settings.DEBUG:
|
|||
|
||||
if "silk" in settings.INSTALLED_APPS:
|
||||
urlpatterns = [
|
||||
url(r"^api/silk/", include("silk.urls", namespace="silk"))
|
||||
re_path(r"^api/silk/", include("silk.urls", namespace="silk"))
|
||||
] + urlpatterns
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.conf.urls import include
|
||||
from django.urls import re_path
|
||||
|
||||
from funkwhale_api.activity import views as activity_views
|
||||
from funkwhale_api.audio import views as audio_views
|
||||
|
@ -28,61 +29,61 @@ router.register(r"attachments", common_views.AttachmentViewSet, "attachments")
|
|||
v1_patterns = router.urls
|
||||
|
||||
v1_patterns += [
|
||||
url(r"^oembed/$", views.OembedView.as_view(), name="oembed"),
|
||||
url(
|
||||
re_path(r"^oembed/$", views.OembedView.as_view(), name="oembed"),
|
||||
re_path(
|
||||
r"^instance/",
|
||||
include(("funkwhale_api.instance.urls", "instance"), namespace="instance"),
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r"^manage/",
|
||||
include(("funkwhale_api.manage.urls", "manage"), namespace="manage"),
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r"^moderation/",
|
||||
include(
|
||||
("funkwhale_api.moderation.urls", "moderation"), namespace="moderation"
|
||||
),
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r"^federation/",
|
||||
include(
|
||||
("funkwhale_api.federation.api_urls", "federation"), namespace="federation"
|
||||
),
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r"^providers/",
|
||||
include(("funkwhale_api.providers.urls", "providers"), namespace="providers"),
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r"^favorites/",
|
||||
include(("funkwhale_api.favorites.urls", "favorites"), namespace="favorites"),
|
||||
),
|
||||
url(r"^search$", views.Search.as_view(), name="search"),
|
||||
url(
|
||||
re_path(r"^search$", views.Search.as_view(), name="search"),
|
||||
re_path(
|
||||
r"^radios/",
|
||||
include(("funkwhale_api.radios.urls", "radios"), namespace="radios"),
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r"^history/",
|
||||
include(("funkwhale_api.history.urls", "history"), namespace="history"),
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r"^",
|
||||
include(("funkwhale_api.users.api_urls", "users"), namespace="users"),
|
||||
),
|
||||
# XXX: remove if Funkwhale 1.1
|
||||
url(
|
||||
re_path(
|
||||
r"^users/",
|
||||
include(("funkwhale_api.users.api_urls", "users"), namespace="users-nested"),
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r"^oauth/",
|
||||
include(("funkwhale_api.users.oauth.urls", "oauth"), namespace="oauth"),
|
||||
),
|
||||
url(r"^rate-limit/?$", common_views.RateLimitView.as_view(), name="rate-limit"),
|
||||
url(
|
||||
re_path(r"^rate-limit/?$", common_views.RateLimitView.as_view(), name="rate-limit"),
|
||||
re_path(
|
||||
r"^text-preview/?$", common_views.TextPreviewView.as_view(), name="text-preview"
|
||||
),
|
||||
]
|
||||
|
||||
urlpatterns = [url("", include((v1_patterns, "v1"), namespace="v1"))]
|
||||
urlpatterns = [re_path("", include((v1_patterns, "v1"), namespace="v1"))]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.conf.urls import include
|
||||
from django.urls import re_path
|
||||
|
||||
from funkwhale_api.common import routers as common_routers
|
||||
|
||||
|
@ -6,14 +7,14 @@ router = common_routers.OptionalSlashRouter()
|
|||
v2_patterns = router.urls
|
||||
|
||||
v2_patterns += [
|
||||
url(
|
||||
re_path(
|
||||
r"^instance/",
|
||||
include(("funkwhale_api.instance.urls_v2", "instance"), namespace="instance"),
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r"^radios/",
|
||||
include(("funkwhale_api.radios.urls_v2", "radios"), namespace="radios"),
|
||||
),
|
||||
]
|
||||
|
||||
urlpatterns = [url("", include((v2_patterns, "v2"), namespace="v2"))]
|
||||
urlpatterns = [re_path("", include((v2_patterns, "v2"), namespace="v2"))]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.conf.urls import include
|
||||
from django.urls import re_path
|
||||
from rest_framework import routers
|
||||
from rest_framework.urlpatterns import format_suffix_patterns
|
||||
|
||||
|
@ -8,7 +9,9 @@ subsonic_router = routers.SimpleRouter(trailing_slash=False)
|
|||
subsonic_router.register(r"rest", SubsonicViewSet, basename="subsonic")
|
||||
|
||||
subsonic_patterns = format_suffix_patterns(subsonic_router.urls, allowed=["view"])
|
||||
urlpatterns = [url("", include((subsonic_patterns, "subsonic"), namespace="subsonic"))]
|
||||
urlpatterns = [
|
||||
re_path("", include((subsonic_patterns, "subsonic"), namespace="subsonic"))
|
||||
]
|
||||
|
||||
# urlpatterns = [
|
||||
# url(
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.conf.urls import include
|
||||
from django.urls import re_path
|
||||
from rest_framework import routers
|
||||
|
||||
from . import views
|
||||
|
@ -23,6 +24,8 @@ music_router.register(r"tracks", views.MusicTrackViewSet, "tracks")
|
|||
index_router.register(r"index", views.IndexViewSet, "index")
|
||||
|
||||
urlpatterns = router.urls + [
|
||||
url("federation/music/", include((music_router.urls, "music"), namespace="music")),
|
||||
url("federation/", include((index_router.urls, "index"), namespace="index")),
|
||||
re_path(
|
||||
"federation/music/", include((music_router.urls, "music"), namespace="music")
|
||||
),
|
||||
re_path("federation/", include((index_router.urls, "index"), namespace="index")),
|
||||
]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import re_path
|
||||
|
||||
from funkwhale_api.common import routers
|
||||
|
||||
|
@ -8,7 +8,7 @@ admin_router = routers.OptionalSlashRouter()
|
|||
admin_router.register(r"admin/settings", views.AdminSettings, "admin-settings")
|
||||
|
||||
urlpatterns = [
|
||||
url(r"^nodeinfo/2.0/?$", views.NodeInfo20.as_view(), name="nodeinfo-2.0"),
|
||||
url(r"^settings/?$", views.InstanceSettings.as_view(), name="settings"),
|
||||
url(r"^spa-manifest.json", views.SpaManifest.as_view(), name="spa-manifest"),
|
||||
re_path(r"^nodeinfo/2.0/?$", views.NodeInfo20.as_view(), name="nodeinfo-2.0"),
|
||||
re_path(r"^settings/?$", views.InstanceSettings.as_view(), name="settings"),
|
||||
re_path(r"^spa-manifest.json", views.SpaManifest.as_view(), name="spa-manifest"),
|
||||
] + admin_router.urls
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import re_path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r"^nodeinfo/2.1/?$", views.NodeInfo21.as_view(), name="nodeinfo-2.1"),
|
||||
re_path(r"^nodeinfo/2.1/?$", views.NodeInfo21.as_view(), name="nodeinfo-2.1"),
|
||||
]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.conf.urls import include
|
||||
from django.urls import re_path
|
||||
|
||||
from funkwhale_api.common import routers
|
||||
|
||||
|
@ -32,14 +33,16 @@ other_router.register(r"channels", views.ManageChannelViewSet, "channels")
|
|||
other_router.register(r"tags", views.ManageTagViewSet, "tags")
|
||||
|
||||
urlpatterns = [
|
||||
url(
|
||||
re_path(
|
||||
r"^federation/",
|
||||
include((federation_router.urls, "federation"), namespace="federation"),
|
||||
),
|
||||
url(r"^library/", include((library_router.urls, "instance"), namespace="library")),
|
||||
url(
|
||||
re_path(
|
||||
r"^library/", include((library_router.urls, "instance"), namespace="library")
|
||||
),
|
||||
re_path(
|
||||
r"^moderation/",
|
||||
include((moderation_router.urls, "moderation"), namespace="moderation"),
|
||||
),
|
||||
url(r"^users/", include((users_router.urls, "instance"), namespace="users")),
|
||||
re_path(r"^users/", include((users_router.urls, "instance"), namespace="users")),
|
||||
] + other_router.urls
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import re_path
|
||||
|
||||
from funkwhale_api.common import routers
|
||||
|
||||
|
@ -7,22 +7,22 @@ from . import views
|
|||
router = routers.OptionalSlashRouter()
|
||||
router.register(r"search", views.SearchViewSet, "search")
|
||||
urlpatterns = [
|
||||
url(
|
||||
re_path(
|
||||
"releases/(?P<uuid>[0-9a-z-]+)/$",
|
||||
views.ReleaseDetail.as_view(),
|
||||
name="release-detail",
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
"artists/(?P<uuid>[0-9a-z-]+)/$",
|
||||
views.ArtistDetail.as_view(),
|
||||
name="artist-detail",
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
"release-groups/browse/(?P<artist_uuid>[0-9a-z-]+)/$",
|
||||
views.ReleaseGroupBrowse.as_view(),
|
||||
name="release-group-browse",
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
"releases/browse/(?P<release_group_uuid>[0-9a-z-]+)/$",
|
||||
views.ReleaseBrowse.as_view(),
|
||||
name="release-browse",
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.conf.urls import include
|
||||
from django.urls import re_path
|
||||
|
||||
urlpatterns = [
|
||||
url(
|
||||
re_path(
|
||||
r"^musicbrainz/",
|
||||
include(
|
||||
("funkwhale_api.musicbrainz.urls", "musicbrainz"), namespace="musicbrainz"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import re_path
|
||||
|
||||
from funkwhale_api.common import routers
|
||||
|
||||
|
@ -8,6 +8,6 @@ router = routers.OptionalSlashRouter()
|
|||
router.register(r"users", views.UserViewSet, "users")
|
||||
|
||||
urlpatterns = [
|
||||
url(r"^users/login/?$", views.login, name="login"),
|
||||
url(r"^users/logout/?$", views.logout, name="logout"),
|
||||
re_path(r"^users/login/?$", views.login, name="login"),
|
||||
re_path(r"^users/logout/?$", views.logout, name="logout"),
|
||||
] + router.urls
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from django.conf.urls import url
|
||||
from django.urls import re_path
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
|
||||
from funkwhale_api.common import routers
|
||||
|
@ -10,7 +10,9 @@ router.register(r"apps", views.ApplicationViewSet, "apps")
|
|||
router.register(r"grants", views.GrantViewSet, "grants")
|
||||
|
||||
urlpatterns = router.urls + [
|
||||
url("^authorize/$", csrf_exempt(views.AuthorizeView.as_view()), name="authorize"),
|
||||
url("^token/$", views.TokenView.as_view(), name="token"),
|
||||
url("^revoke/$", views.RevokeTokenView.as_view(), name="revoke"),
|
||||
re_path(
|
||||
"^authorize/$", csrf_exempt(views.AuthorizeView.as_view()), name="authorize"
|
||||
),
|
||||
re_path("^token/$", views.TokenView.as_view(), name="token"),
|
||||
re_path("^revoke/$", views.RevokeTokenView.as_view(), name="revoke"),
|
||||
]
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
from dj_rest_auth import views as rest_auth_views
|
||||
from django.conf.urls import url
|
||||
from django.urls import re_path
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
# URLs that do not require a session or valid token
|
||||
url(
|
||||
re_path(
|
||||
r"^password/reset/$",
|
||||
views.PasswordResetView.as_view(),
|
||||
name="rest_password_reset",
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r"^password/reset/confirm/$",
|
||||
views.PasswordResetConfirmView.as_view(),
|
||||
name="rest_password_reset_confirm",
|
||||
),
|
||||
# URLs that require a user to be logged in with a valid session / token.
|
||||
url(
|
||||
re_path(
|
||||
r"^user/$", rest_auth_views.UserDetailsView.as_view(), name="rest_user_details"
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r"^password/change/$",
|
||||
views.PasswordChangeView.as_view(),
|
||||
name="rest_password_change",
|
||||
),
|
||||
# Registration URLs
|
||||
url(r"^registration/$", views.RegisterView.as_view(), name="rest_register"),
|
||||
url(
|
||||
re_path(r"^registration/$", views.RegisterView.as_view(), name="rest_register"),
|
||||
re_path(
|
||||
r"^registration/verify-email/?$",
|
||||
views.VerifyEmailView.as_view(),
|
||||
name="rest_verify_email",
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r"^registration/change-password/?$",
|
||||
views.PasswordChangeView.as_view(),
|
||||
name="change_password",
|
||||
|
@ -47,7 +47,7 @@ urlpatterns = [
|
|||
# If you don't want to use API on that step, then just use ConfirmEmailView
|
||||
# view from:
|
||||
# https://github.com/pennersr/django-allauth/blob/a62a370681/allauth/account/views.py#L291
|
||||
url(
|
||||
re_path(
|
||||
r"^registration/account-confirm-email/(?P<key>\w+)/?$",
|
||||
TemplateView.as_view(),
|
||||
name="account_confirm_email",
|
||||
|
|
Loading…
Reference in New Issue