Skip to content

Commit

Permalink
chore: update from tmpl
Browse files Browse the repository at this point in the history
  • Loading branch information
OrenZhang committed Jul 12, 2024
1 parent b3f676a commit e3a8e4e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/OVINC-CN/DevTemplateDjango.git",
"commit": "6957e612ab3e625ffd602eeed7ddfa462ac2f296",
"commit": "1f60474cf9d2d6792d4c8ee66ffc744ab87c75db",
"checkout": "main",
"context": {
"cookiecutter": {
Expand Down
5 changes: 2 additions & 3 deletions entry/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
SECRET_KEY = getenv_or_raise("APP_SECRET")

# Hosts
BACKEND_URL = getenv_or_raise("BACKEND_URL")
ALLOWED_HOSTS = [getenv_or_raise("BACKEND_HOST")]
CORS_ALLOW_CREDENTIALS = strtobool(os.getenv("CORS_ALLOW_CREDENTIALS", "True"))
CORS_ORIGIN_WHITELIST = [getenv_or_raise("FRONTEND_URL")]
Expand Down Expand Up @@ -61,9 +62,6 @@
"django.contrib.auth.middleware.AuthenticationMiddleware",
"ovinc_client.core.middlewares.SQLDebugMiddleware",
]
if DEBUG:
MIDDLEWARE += ["pyinstrument.middleware.ProfilerMiddleware"]
PYINSTRUMENT_PROFILE_DIR = ".report"
if not DEBUG:
MIDDLEWARE += ["ovinc_client.core.middlewares.UnHandleExceptionMiddleware"]

Expand Down Expand Up @@ -201,6 +199,7 @@

# OVINC
OVINC_API_DOMAIN = getenv_or_raise("OVINC_API_DOMAIN")
OVINC_WEB_URL = getenv_or_raise("OVINC_WEB_URL")
OVINC_API_RECORD_LOG = strtobool(os.getenv("OVINC_API_RECORD_LOG", "True"))

# OpenAI
Expand Down
7 changes: 7 additions & 0 deletions entry/urls.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from urllib.parse import quote

from django.conf import settings
from django.contrib import admin
from django.contrib.staticfiles.views import serve
Expand All @@ -11,9 +13,14 @@ def serve_static(request, path, insecure=True, **kwargs):
return serve(request, path, insecure=True, **kwargs)


ADMIN_PAGE_URL = f"{settings.BACKEND_URL}/admin/"
FRONTEND_LOGIN_URL = f"{settings.FRONTEND_URL}/login/?next={quote(ADMIN_PAGE_URL)}"
ADMIN_PAGE_LOGIN_URL = f"{settings.OVINC_WEB_URL}/login/?next={quote(FRONTEND_LOGIN_URL)}"

urlpatterns = [
path("favicon.ico", RedirectView.as_view(url=f"{settings.FRONTEND_URL}/favicon.ico")),
re_path(r"^static/(?P<path>.*)$", serve_static, name="static"),
path("admin/login/", RedirectView.as_view(url=ADMIN_PAGE_LOGIN_URL.replace("%", "%%"))),
path("admin/", admin.site.urls),
path("account/", include("ovinc_client.account.urls")),
path("", include("apps.home.urls")),
Expand Down
3 changes: 0 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ arrow==1.2.3
# RSA
pycryptodome==3.20.0

# Profile
pyinstrument==4.4.0

# OpenAI
openai==1.12.0
tiktoken==0.7.0
Expand Down

0 comments on commit e3a8e4e

Please sign in to comment.