Merge remote-tracking branch 'origin/main' into wilm
This commit is contained in:
@@ -33,9 +33,22 @@ Dry run by default; nothing is written without --commit.
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Load .env before anything reads config. wsgi.py does this for the served app
|
||||
# and the `flask` CLI does it for itself, but a plain `python scripts/...` run
|
||||
# gets neither: DATABASE_URL stays unset, FLASK_ENV defaults to development,
|
||||
# and config falls back to a hardcoded root@localhost URL. That fails on a real
|
||||
# deployment with a bare 1045 Access denied for 'root', naming a user the site
|
||||
# does not use - and on a box where those root credentials happen to work, it
|
||||
# is worse, because the script silently reads or WRITES the wrong database.
|
||||
load_dotenv(Path(__file__).resolve().parent.parent / '.env')
|
||||
|
||||
|
||||
# Each asset table that carries both a model link and its own vendor, with the
|
||||
# column that identifies a row in reports and logs.
|
||||
TARGETS = [
|
||||
|
||||
@@ -38,11 +38,24 @@ database backup before --commit anyway; this deletes rows.
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from collections import defaultdict
|
||||
|
||||
# Run from anywhere: put the repo root (parent of scripts/) on the path.
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Load .env before anything reads config. wsgi.py does this for the served app
|
||||
# and the `flask` CLI does it for itself, but a plain `python scripts/...` run
|
||||
# gets neither: DATABASE_URL stays unset, FLASK_ENV defaults to development,
|
||||
# and config falls back to a hardcoded root@localhost URL. That fails on a real
|
||||
# deployment with a bare 1045 Access denied for 'root', naming a user the site
|
||||
# does not use - and on a box where those root credentials happen to work, it
|
||||
# is worse, because the script silently reads or WRITES the wrong database.
|
||||
load_dotenv(Path(__file__).resolve().parent.parent / '.env')
|
||||
|
||||
|
||||
from shopdb import create_app
|
||||
from shopdb.api import db
|
||||
from shopdb.core.models import Asset
|
||||
|
||||
@@ -25,10 +25,23 @@ import argparse
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from collections import OrderedDict
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Load .env before anything reads config. wsgi.py does this for the served app
|
||||
# and the `flask` CLI does it for itself, but a plain `python scripts/...` run
|
||||
# gets neither: DATABASE_URL stays unset, FLASK_ENV defaults to development,
|
||||
# and config falls back to a hardcoded root@localhost URL. That fails on a real
|
||||
# deployment with a bare 1045 Access denied for 'root', naming a user the site
|
||||
# does not use - and on a box where those root credentials happen to work, it
|
||||
# is worse, because the script silently reads or WRITES the wrong database.
|
||||
load_dotenv(Path(__file__).resolve().parent.parent / '.env')
|
||||
|
||||
|
||||
DEFAULT_OUT = os.path.join('shopdb', 'data', 'catalog.json')
|
||||
|
||||
|
||||
|
||||
@@ -21,10 +21,23 @@ Dry run by default. Nothing is written without --commit.
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Load .env before anything reads config. wsgi.py does this for the served app
|
||||
# and the `flask` CLI does it for itself, but a plain `python scripts/...` run
|
||||
# gets neither: DATABASE_URL stays unset, FLASK_ENV defaults to development,
|
||||
# and config falls back to a hardcoded root@localhost URL. That fails on a real
|
||||
# deployment with a bare 1045 Access denied for 'root', naming a user the site
|
||||
# does not use - and on a box where those root credentials happen to work, it
|
||||
# is worse, because the script silently reads or WRITES the wrong database.
|
||||
load_dotenv(Path(__file__).resolve().parent.parent / '.env')
|
||||
|
||||
|
||||
from shopdb import create_app # noqa: E402
|
||||
from shopdb.api import db # noqa: E402
|
||||
|
||||
|
||||
@@ -19,10 +19,23 @@ Usage (on the target instance, in the app dir):
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
# Run from anywhere: put the repo root (parent of scripts/) on the path.
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Load .env before anything reads config. wsgi.py does this for the served app
|
||||
# and the `flask` CLI does it for itself, but a plain `python scripts/...` run
|
||||
# gets neither: DATABASE_URL stays unset, FLASK_ENV defaults to development,
|
||||
# and config falls back to a hardcoded root@localhost URL. That fails on a real
|
||||
# deployment with a bare 1045 Access denied for 'root', naming a user the site
|
||||
# does not use - and on a box where those root credentials happen to work, it
|
||||
# is worse, because the script silently reads or WRITES the wrong database.
|
||||
load_dotenv(Path(__file__).resolve().parent.parent / '.env')
|
||||
|
||||
|
||||
from shopdb import create_app
|
||||
from shopdb.api import db
|
||||
from shopdb.core.models import Asset, AssetType
|
||||
|
||||
@@ -35,11 +35,24 @@ Dry run by default. Take a database backup before --commit.
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from collections import defaultdict
|
||||
|
||||
# Run from anywhere: put the repo root (parent of scripts/) on the path.
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Load .env before anything reads config. wsgi.py does this for the served app
|
||||
# and the `flask` CLI does it for itself, but a plain `python scripts/...` run
|
||||
# gets neither: DATABASE_URL stays unset, FLASK_ENV defaults to development,
|
||||
# and config falls back to a hardcoded root@localhost URL. That fails on a real
|
||||
# deployment with a bare 1045 Access denied for 'root', naming a user the site
|
||||
# does not use - and on a box where those root credentials happen to work, it
|
||||
# is worse, because the script silently reads or WRITES the wrong database.
|
||||
load_dotenv(Path(__file__).resolve().parent.parent / '.env')
|
||||
|
||||
|
||||
from shopdb import create_app
|
||||
from shopdb.api import db, Asset, AssetRelationship, RelationshipType
|
||||
from plugins.backups.models import BackupRevision
|
||||
|
||||
@@ -33,9 +33,22 @@ import csv
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Load .env before anything reads config. wsgi.py does this for the served app
|
||||
# and the `flask` CLI does it for itself, but a plain `python scripts/...` run
|
||||
# gets neither: DATABASE_URL stays unset, FLASK_ENV defaults to development,
|
||||
# and config falls back to a hardcoded root@localhost URL. That fails on a real
|
||||
# deployment with a bare 1045 Access denied for 'root', naming a user the site
|
||||
# does not use - and on a box where those root credentials happen to work, it
|
||||
# is worse, because the script silently reads or WRITES the wrong database.
|
||||
load_dotenv(Path(__file__).resolve().parent.parent / '.env')
|
||||
|
||||
|
||||
# Each asset class, its own type vocabulary, and the modeltypes.category that a
|
||||
# newly created model type should carry.
|
||||
CLASSES = {
|
||||
|
||||
Reference in New Issue
Block a user