aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2022-02-15 11:28:51 -0500
committerB Stack <bgstack15@gmail.com>2022-02-15 11:28:51 -0500
commit19e973b60b07578cb71a9334a737053136dc6bbb (patch)
tree64126a9a986e226dcc8e179a602107ff2b233ab0
parentload stackbin_conf from env (diff)
downloadstackbin-19e973b60b07578cb71a9334a737053136dc6bbb.tar.gz
stackbin-19e973b60b07578cb71a9334a737053136dc6bbb.tar.bz2
stackbin-19e973b60b07578cb71a9334a737053136dc6bbb.zip
initialize database in app
-rw-r--r--stackbin.conf.example3
-rwxr-xr-xstackbin.py2
2 files changed, 4 insertions, 1 deletions
diff --git a/stackbin.conf.example b/stackbin.conf.example
index 5a590e5..0bb131d 100644
--- a/stackbin.conf.example
+++ b/stackbin.conf.example
@@ -1,5 +1,6 @@
DEBUG=False
-SQLALCHEMY_DATABASE_URI='sqlite:///stackbin.db'
+SQLALCHEMY_DATABASE_URI='sqlite:////var/stackbin/stackbin.db'
+SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY='development-key'
SALT='jackson'
DELETESALT='differentstring'
diff --git a/stackbin.py b/stackbin.py
index f4059f0..ad5b047 100755
--- a/stackbin.py
+++ b/stackbin.py
@@ -302,5 +302,7 @@ def get_proxied_path():
app.wsgi_app = ProxyFix(app.wsgi_app,x_for=pl,x_host=pl,x_port=pl,x_prefix=pl,x_proto=pl)
return redirect(url_for('new_paste'))
+# Initialize the database if it does not already exist
+db.create_all()
if __name__ == "__main__":
app.run()
bgstack15