Ver código fonte

Dockerizing - Modify DB Path

hoparkgo9ma 7 anos atrás
pai
commit
a63fee1bcc
2 arquivos alterados com 3 adições e 2 exclusões
  1. 1 0
      .gitignore
  2. 2 2
      app.py

+ 1 - 0
.gitignore

@@ -5,6 +5,7 @@ __pycache__
 .vscode
 
 *.db
+*.db-journal
 image
 robots.txt
 

+ 2 - 2
app.py

@@ -17,7 +17,7 @@ try:
     set_data = json.loads(open('data/set.json').read())
 except:
     if os.getenv('NAMU_DB') != None:
-        set_data = { "db" : os.getenv('NAMU_DB') }
+        set_data = { "db" : 'data/' + os.getenv('NAMU_DB') }
     else:
         print('DB\'s name (data) : ', end = '')
         
@@ -26,7 +26,7 @@ except:
             new_json = 'data'
             
         with open('data/set.json', 'w') as f:
-            f.write('{ "db" : "' + new_json + '" }')
+            f.write('{ "db" : "data/' + new_json + '" }')
             
         set_data = json.loads(open('data/set.json').read())