migration-fixes
This commit is contained in:
parent
51c7f68ceb
commit
0cd6761dd3
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -144,4 +144,5 @@ migration/content/**/*.md
|
|||
*.rdb
|
||||
.DS_Store
|
||||
dump
|
||||
.vscode
|
||||
.vscode
|
||||
*.sql
|
|
@ -5,7 +5,7 @@ import json
|
|||
from migration.utils import DateTimeEncoder
|
||||
|
||||
def json_tables():
|
||||
print('[migration] unpack bson to migration/data/*.json')
|
||||
print('[migration] unpack dump/discours/*.bson to migration/data/*.json')
|
||||
data = {
|
||||
"content_items": [],
|
||||
"content_item_categories": [],
|
||||
|
@ -16,7 +16,7 @@ def json_tables():
|
|||
}
|
||||
for table in data.keys():
|
||||
lc = []
|
||||
with open('migration/data/'+table+'.bson', 'rb') as f:
|
||||
with open('dump/discours/'+table+'.bson', 'rb') as f:
|
||||
bs = f.read()
|
||||
f.close()
|
||||
base = 0
|
||||
|
@ -24,5 +24,5 @@ def json_tables():
|
|||
base, d = bson.decode_document(bs, base)
|
||||
lc.append(d)
|
||||
data[table] = lc
|
||||
open(os.getcwd() + '/dump/discours/'+table+'.json', 'w').write(json.dumps(lc,cls=DateTimeEncoder))
|
||||
open(os.getcwd() + '/migration/data/'+table+'.json', 'w').write(json.dumps(lc,cls=DateTimeEncoder))
|
||||
|
||||
|
|
|
@ -2,11 +2,9 @@ import sqlalchemy
|
|||
from orm import User, UserRating
|
||||
from orm.user import EmailSubscription
|
||||
from dateutil.parser import parse
|
||||
from migration.html2text import html2text
|
||||
from orm.base import local_session
|
||||
|
||||
def migrate(entry):
|
||||
|
||||
if 'subscribedTo' in entry: del entry['subscribedTo']
|
||||
email = entry['emails'][0]['address']
|
||||
user_dict = {
|
||||
|
|
|
@ -10,7 +10,7 @@ RESET_PWD_URL = environ.get("RESET_PWD_URL") or "https://localhost:8080/reset_pw
|
|||
CONFIRM_EMAIL_URL = environ.get("CONFIRM_EMAIL_URL") or "https://new.discours.io"
|
||||
ERROR_URL_ON_FRONTEND = environ.get("ERROR_URL_ON_FRONTEND") or "https://new.discours.io"
|
||||
|
||||
DB_URL = environ.get("DATABASE_URL") or environ.get("DB_URL") or "sqlite:///db.sqlite3"
|
||||
DB_URL = environ.get("DATABASE_URL") or environ.get("DB_URL") or "postgres://localhost:5432" or "sqlite:///db.sqlite3"
|
||||
JWT_ALGORITHM = "HS256"
|
||||
JWT_SECRET_KEY = "8f1bd7696ffb482d8486dfbc6e7d16dd-secret-key"
|
||||
JWT_LIFE_SPAN = 24 * 60 * 60 # seconds
|
||||
|
|
Loading…
Reference in New Issue
Block a user