perf: 优化 url

pull/11012/head
ibuler 1 year ago
parent f466904a1c
commit 8ed8d6f01c

@ -106,15 +106,15 @@ class Account(AbsConnectivity, BaseAccount):
def get_anonymous_account(cls):
return cls(name=AliasAccount.ANON.label, username=AliasAccount.ANON.value, secret=None)
@lazyproperty
def versions(self):
return self.history.count()
@classmethod
def get_user_account(cls):
""" @USER 动态用户的账号(self) """
return cls(name=AliasAccount.USER.label, username=AliasAccount.USER.value, secret=None)
@lazyproperty
def versions(self):
return self.history.count()
def get_su_from_accounts(self):
""" 排除自己和以自己为 su-from 的账号 """
return self.asset.accounts.exclude(id=self.id).exclude(su_from=self)

@ -1,8 +1,10 @@
import multiprocessing
from django.core.management.base import BaseCommand, CommandError
from django.core.management.base import BaseCommand
from django.db.models import TextChoices
from .utils import ServicesUtil
from .hands import *
from .utils import ServicesUtil
class Services(TextChoices):

@ -49,13 +49,11 @@ if settings.XPACK_ENABLED:
urlpatterns = [
path('', views.IndexView.as_view(), name='index'),
path('api/v1/', include(api_v1)),
re_path('api/(?P<app>\w+)/(?P<version>v\d)/.*', views.redirect_format_api),
path('api/health/', api.HealthCheckView.as_view(), name="health"),
path('api/v1/health/', api.HealthCheckView.as_view(), name="health_v1"),
# External apps url
path('core/auth/captcha/', include('captcha.urls')),
path('core/', include(app_view_patterns)),
path('ui/', views.UIView.as_view()),
]
# 静态文件处理路由
@ -66,7 +64,9 @@ urlpatterns += [
]
if settings.DEBUG:
urlpatterns += static('/luna/', document_root=(settings.DATA_DIR + '/luna'))
urlpatterns += static('/lina/', document_root=(settings.DATA_DIR + '/lina'))
urlpatterns += static('/ui/', document_root=(settings.DATA_DIR + '/lina'))
else:
urlpatterns += path('ui/', views.UIView.as_view()),
# js i18n 路由文件
urlpatterns += [

Loading…
Cancel
Save