diff --git a/contest/contest/urls.py b/contest/contest/urls.py index e6cf952..51fcbc7 100644 --- a/contest/contest/urls.py +++ b/contest/contest/urls.py @@ -20,10 +20,18 @@ from django.urls import include, path from django_cas_ng import views as cas_views +from .settings import DEBUG + urlpatterns = [ path("", include("quiz.urls")), path("admin/", admin.site.urls), path("accounts/login/", cas_views.LoginView.as_view(), name="login"), path("accounts/logout/", cas_views.LogoutView.as_view(), name="logout"), - path("__reload__/", include("django_browser_reload.urls")), ] + +if DEBUG: + urlpatterns.extend( + [ + path("__reload__/", include("django_browser_reload.urls")), + ] + ) diff --git a/justfile b/justfile index c6a52de..71318ac 100644 --- a/justfile +++ b/justfile @@ -10,6 +10,12 @@ is_dev := if env_var_or_default("DJANGO_PRODUCTION", "") == "" { "false" } +poetry_install_additional_args := if env_var_or_default("CI", "") == "" { + "" +} else { + "--sync" +} + src_dir := "contest" @@ -46,7 +52,7 @@ check-deploy: && test (manage "check" "--deploy") # 更新依赖、数据库等(拉取他人提交后建议运行) update: && (manage "migrate") - poetry install --no-root {{ if is_dev == "false" { "--without dev" } else { "" } }} + poetry install --no-root {{ if is_dev == "false" { "--without dev" } else { "" } }} {{ poetry_install_additional_args }} {{ if is_dev == "true" { "pnpm --dir " + src_dir + "/theme/static_src/ install" } else { "" } }} {{ if is_dev == "true" { "pnpm --dir " + src_dir + "/js/static_src/ install" } else { "" } }}