瀏覽代碼

Add database url config

Colin Powell 3 年之前
父節點
當前提交
cab99c3618
共有 4 個文件被更改,包括 47 次插入18 次删除
  1. 3 2
      emus.conf.example
  2. 29 14
      emus/settings.py
  3. 14 2
      poetry.lock
  4. 1 0
      pyproject.toml

+ 3 - 2
emus.conf.example

@@ -1,5 +1,6 @@
 # You can use this file to set environment variables for your local setup
 #
-EMUS_SCRAPER_USER=""
-EMUS_SCRAPER_PASS=""
+EMUS_MEDIA_ROOT="/media"
+EMUS_SCRAPER_CONFIG_PATH="/etc/skyscraper.ini"
+EMUS_DATABASE_URL="postgres://USER:PASSWORD@HOST:PORT/NAME"
 EMUS_JSON_LOGGING=True

+ 29 - 14
emus/settings.py

@@ -78,20 +78,7 @@ TEMPLATES = [
 
 WSGI_APPLICATION = "emus.wsgi.application"
 
-
-# Database
-# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
-
-DATABASES = {
-    "default": {
-        "ENGINE": "django.db.backends.sqlite3",
-        "NAME": BASE_DIR / "db.sqlite3",
-    }
-}
-
-
-# Password validation
-# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
+DATABASE_URL = os.getenv("EMUS_DATABASE_URL", "sqlite:///db.sqlite3")
 
 AUTH_PASSWORD_VALIDATORS = [
     {
@@ -148,6 +135,34 @@ RETROPIE_WEBRETRO_SYSTEM_MAP = {
     "snes": "snes9x",
 }
 
+RETROPIE_RETROARCH_WEB_SYSTEM_MAP = {
+    "3do": "opera",
+    "atarijaguar": "virtualjaguar",
+    "coleco": "bluemsx",
+    "dreamcast": "flycast",
+    "gb": "gambatte",
+    "gba": "mgba",
+    "gbc": "gambatte",
+    "gc": "dolphin",
+    "megadrive": "genesis_plus_gx",
+    "gamgear": "genesis_plus_gx",
+    "atarilynx": "handy",
+    "msx": "bluemsx",
+    "n64": "mupen64plus_next",
+    "nds": "desmume",
+    "ngp": "fbneo",
+    "ngpc": "fbneo",
+    "nes": "nestopia",
+    "pcengine": "mednafen_supergrafx",
+    "psp": "ppsspp",
+    "psx": "mednafen_psx",
+    "saturn": "mednafen_saturn",
+    "scummvm": "",
+    "segacd": "genesis_plus_gx",
+    "snes": "snes9x",
+    "wii": "dolphin",
+}
+
 default_level = "INFO"
 if DEBUG:
     default_level = "DEBUG"

+ 14 - 2
poetry.lock

@@ -42,6 +42,14 @@ colorama = {version = "*", markers = "sys_platform == \"win32\""}
 [package.extras]
 development = ["black", "flake8", "mypy", "pytest", "types-colorama"]
 
+[[package]]
+name = "dj-database-url"
+version = "0.5.0"
+description = "Use Database URLs in your Django Application."
+category = "main"
+optional = false
+python-versions = "*"
+
 [[package]]
 name = "django"
 version = "4.0.3"
@@ -141,7 +149,7 @@ name = "psycopg2"
 version = "2.9.3"
 description = "psycopg2 - Python-PostgreSQL Database Adapter"
 category = "main"
-optional = true
+optional = false
 python-versions = ">=3.6"
 
 [[package]]
@@ -221,7 +229,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-
 [metadata]
 lock-version = "1.1"
 python-versions = "^3.8"
-content-hash = "1914f0a474b0f5d48e19328574709f0193de5555ed279c38496de20db6149a28"
+content-hash = "45cc84e2a641f09941628bbee75fb65069fd217a19d6b67817061ad0a0dc7d61"
 
 [metadata.files]
 asgiref = [
@@ -254,6 +262,10 @@ colorlog = [
     {file = "colorlog-6.6.0-py2.py3-none-any.whl", hash = "sha256:351c51e866c86c3217f08e4b067a7974a678be78f07f85fc2d55b8babde6d94e"},
     {file = "colorlog-6.6.0.tar.gz", hash = "sha256:344f73204009e4c83c5b6beb00b3c45dc70fcdae3c80db919e0a4171d006fde8"},
 ]
+dj-database-url = [
+    {file = "dj-database-url-0.5.0.tar.gz", hash = "sha256:4aeaeb1f573c74835b0686a2b46b85990571159ffc21aa57ecd4d1e1cb334163"},
+    {file = "dj_database_url-0.5.0-py2.py3-none-any.whl", hash = "sha256:851785365761ebe4994a921b433062309eb882fedd318e1b0fcecc607ed02da9"},
+]
 django = [
     {file = "Django-4.0.3-py3-none-any.whl", hash = "sha256:1239218849e922033a35d2a2f777cb8bee18bd725416744074f455f34ff50d0c"},
     {file = "Django-4.0.3.tar.gz", hash = "sha256:77ff2e7050e3324c9b67e29b6707754566f58514112a9ac73310f60cd5261930"},

+ 1 - 0
pyproject.toml

@@ -17,6 +17,7 @@ Markdown = "^3.3.6"
 django-filter = "^21.1"
 Pillow = "^9.0.1"
 psycopg2 = {version = "^2.9.3", extras = ["production"]}
+dj-database-url = "^0.5.0"
 
 [build-system]
 requires = ["poetry-core>=1.0.0"]