[chore] tweak data file path

This commit is contained in:
SouthFox 2023-05-09 17:19:16 +08:00
parent 9bedcdb625
commit 20b89b5139
3 changed files with 17 additions and 3 deletions

View file

@ -14,7 +14,9 @@ else:
app = Flask(__name__) app = Flask(__name__)
app.config['SECRET_KEY'] = os.getenv('SECRET_KEY', 'dev') app.config['SECRET_KEY'] = os.getenv('SECRET_KEY', 'dev')
app.config['SQLALCHEMY_DATABASE_URI'] = prefix + os.path.join(os.path.dirname(app.root_path), os.getenv('DATABASE_FILE', 'data.db')) app.config['SQLALCHEMY_DATABASE_URI'] = prefix + os.path.join(os.path.dirname(app.root_path),
"data",
os.getenv('DATABASE_FILE', 'data.db'))
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app) db = SQLAlchemy(app)

View file

@ -12,13 +12,13 @@ def app_register(url):
Mastodon.create_app( Mastodon.create_app(
'pyBDSM', 'pyBDSM',
api_base_url = url, api_base_url = url,
to_file = 'pyBDSM_clientcred.secret', to_file = 'data/pyBDSM_clientcred.secret',
scopes=["read"] scopes=["read"]
) )
def app_login(url): def app_login(url):
mastodon = Mastodon( mastodon = Mastodon(
client_id='pyBDSM_clientcred.secret', client_id='data/pyBDSM_clientcred.secret',
access_token='user.secret', access_token='user.secret',
api_base_url=url api_base_url=url
) )

12
data/.gitignore vendored Normal file
View file

@ -0,0 +1,12 @@
.DS_Store
.idea
*.log
tmp/
*.py[cod]
*.egg
build
htmlcov
*.secret
*.db