From 8e8d4d1b29b1219296b92b03ea75e927d7f1e9fb Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 25 Sep 2023 23:22:34 +0000 Subject: [PATCH] default DEBUG ON --- boofilsic/settings.py | 18 +++++++++--------- catalog/search/models.py | 4 ++++ common/setup.py | 2 +- doc/development.md | 2 +- doc/install-docker.md | 1 + docker-compose.yml | 8 ++++---- neodb.env.example | 8 ++++---- 7 files changed, 24 insertions(+), 19 deletions(-) diff --git a/boofilsic/settings.py b/boofilsic/settings.py index 54f69eda..fd993532 100644 --- a/boofilsic/settings.py +++ b/boofilsic/settings.py @@ -15,7 +15,7 @@ environ.Env.read_env(os.path.join(BASE_DIR, ".env")) # ====== List of user configuration variables ====== env = environ.FileAwareEnv( # WARNING: do not run with debug mode turned on in production - NEODB_DEBUG=(bool, False), + NEODB_DEBUG=(bool, True), # WARNING: must use your own key and keep it secret NEODB_SECRET_KEY=(str), # Site information @@ -60,16 +60,16 @@ env = environ.FileAwareEnv( # INTEGRATED TAKAHE CONFIGURATION TAKAHE_DB_URL=(str, "postgres://takahe:takahepass@127.0.0.1:5432/takahe"), # Spotify - https://developer.spotify.com/ - SPOTIFY_API_KEY=(str, ""), + SPOTIFY_API_KEY=(str, "TESTONLY"), # The Movie Database (TMDB) - https://developer.themoviedb.org/ - TMDB_API_V3_KEY=(str, ""), + TMDB_API_V3_KEY=(str, "TESTONLY"), # Google Books - https://developers.google.com/books/docs/v1/using - not used at the moment - GOOGLE_API_KEY=(str, ""), + GOOGLE_API_KEY=(str, "TESTONLY"), # Discogs - personal access token from https://www.discogs.com/settings/developers - DISCOGS_API_KEY=(str, ""), + DISCOGS_API_KEY=(str, "TESTONLY"), # IGDB - https://api-docs.igdb.com/ - IGDB_CLIENT_ID=(str, ""), - IGDB_CLIENT_SECRET=(str, ""), + IGDB_API_CLIENT_ID=(str, "TESTONLY"), + IGDB_API_CLIENT_SECRET=(str, ""), # Discord webhooks DISCORD_WEBHOOKS=(dict, {"user-report": None}), # Slack API token, for sending exceptions to Slack, may deprecate in future @@ -198,8 +198,8 @@ TMDB_API3_KEY = env("TMDB_API_V3_KEY") # TMDB_API4_KEY = env('TMDB_API_V4_KEY') # GOOGLE_API_KEY = env('GOOGLE_API_KEY') DISCOGS_API_KEY = env("DISCOGS_API_KEY") -IGDB_CLIENT_ID = env("IGDB_CLIENT_ID") -IGDB_CLIENT_SECRET = env("IGDB_CLIENT_SECRET") +IGDB_CLIENT_ID = env("IGDB_API_CLIENT_ID") +IGDB_CLIENT_SECRET = env("IGDB_API_CLIENT_SECRET") SLACK_TOKEN = env("SLACK_API_TOKEN") SLACK_CHANNEL = "alert" diff --git a/catalog/search/models.py b/catalog/search/models.py index 3607ea4f..9f5def49 100644 --- a/catalog/search/models.py +++ b/catalog/search/models.py @@ -19,6 +19,10 @@ _logger = logging.getLogger(__name__) class DbIndexer: + @classmethod + def init(cls): + pass + @classmethod def search(cls, q, page=1, categories=None, tag=None, sort=None): result = lambda: None diff --git a/common/setup.py b/common/setup.py index 8b23fcd5..7fae31f6 100644 --- a/common/setup.py +++ b/common/setup.py @@ -1,7 +1,7 @@ from django.conf import settings from loguru import logger -from catalog.search.typesense import Indexer +from catalog.search.models import Indexer from takahe.models import Config as TakaheConfig from takahe.models import Domain as TakaheDomain from takahe.models import Follow as TakaheFollow diff --git a/doc/development.md b/doc/development.md index 94cbaaed..74df8066 100644 --- a/doc/development.md +++ b/doc/development.md @@ -64,7 +64,7 @@ To run local source code with `docker compose`, add `NEODB_DEBUG=True` in `.env` - code in `NEODB_SRC` (default: .) and `TAKAHE_SRC` (default: ./neodb-takahe) will be mounted and used in the container instead of code in the image - `runserver` with autoreload will be used instead of `gunicorn` for both neodb and takahe web server -- /static/ and /s/ url are not map to pre-generated static file path +- /static/ and /s/ url are not map to pre-generated/collected static file path, `NEODB_DEBUG=True` will locate static files from source code - one `rqworker` container will be started, instead of two - use `dev-shell` and `dev-root` to invoke shells, instead of `shell` and `root` - there's no automatic `migration` container, but it can be triggered manually via `docker compose run dev-shell neodb-init` diff --git a/doc/install-docker.md b/doc/install-docker.md index 5a378079..5d579de8 100644 --- a/doc/install-docker.md +++ b/doc/install-docker.md @@ -54,6 +54,7 @@ Change essential options like `NEODB_SITE_DOMAIN` in `.env` before starting the - `NEODB_SITE_DOMAIN` - domain name of your site - `NEODB_SECRET_KEY` - encryption key of session data - `NEODB_DATA` is the path to store db/media/cache, it's `../data` by default, but can be any path that's writable +- `NEODB_DEBUG` - set to `False` for production deployment Optionally, `robots.txt` and `logo.png` may be placed under `$NEODB_DATA/www-root/`. diff --git a/docker-compose.yml b/docker-compose.yml index cd567695..48f18ab9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,7 +34,7 @@ x-shared: NEODB_REDIS_URL: redis://redis:6379/0 NEODB_SEARCH_URL: typesense://user:eggplant@typesense:8108/catalog NEODB_EMAIL_URL: - NEODB_FROM_EMAIL: no-reply@${NEODB_SITE_DOMAIN} + NEODB_EMAIL_FROM: no-reply@${NEODB_SITE_DOMAIN} NEODB_DOWNLOADER_PROXY_LIST: NEODB_DOWNLOADER_BACKUP_PROXY: NEODB_DOWNLOADER_SAVE_DIR: @@ -51,14 +51,14 @@ x-shared: TAKAHE_USE_PROXY_HEADERS: true TAKAHE_STATOR_CONCURRENCY: 4 TAKAHE_STATOR_CONCURRENCY_PER_MODEL: 2 - TAKAHE_DEBUG: ${NEODB_DEBUG:-False} + TAKAHE_DEBUG: ${NEODB_DEBUG:-True} TAKAHE_VENV: /takahe-venv SPOTIFY_API_KEY: TMDB_API_V3_KEY: GOOGLE_API_KEY: DISCOGS_API_KEY: - IGDB_CLIENT_ID: - IGDB_CLIENT_SECRET: + IGDB_API_CLIENT_ID: + IGDB_API_CLIENT_SECRET: DISCORD_WEBHOOKS: SLACK_API_TOKEN: restart: "on-failure" diff --git a/neodb.env.example b/neodb.env.example index 0e82def3..6a4e7499 100644 --- a/neodb.env.example +++ b/neodb.env.example @@ -10,7 +10,10 @@ NEODB_SITE_DOMAIN=example.site NEODB_SITE_NAME=Example Site NEODB_SITE_LOGO=/logo.png NEODB_SITE_ICON=/icon.png -NEODB_SITE_LINKS=关注NiceDB=https://donotban.com/@testie,关注NeoDB=https://mastodon.social/@neodb +NEODB_SITE_LINKS=@NiceDB=https://donotban.com/@testie,@NeoDB=https://mastodon.social/@neodb + +# Turn off DEBUG if you are running as production service +NEODB_DEBUG=False # HTTP port your reverse proxy should send request to # NEODB_PORT=8000 @@ -27,8 +30,5 @@ NEODB_SITE_LINKS=关注NiceDB=https://donotban.com/@testie,关注NeoDB=https://m # TAKAHE_STATOR_CONCURRENCY=10 # TAKAHE_STATOR_CONCURRENCY_PER_MODEL=10 -# Turn on DEBUG mode, either set this to True or don't set it at all -# NEODB_DEBUG=True - # pull NeoDB Docker image from another tag/branch # NEODB_IMAGE=neodb/neodb:latest