Commits

Yang Zhang committed f080a26

change db name to absolute path + name

  • Participants
  • Parent commits ff29c9e

Comments (0)

Files changed (1)

 '''http://flask-script.readthedocs.org/en/latest/'''
 app = Flask(__name__)
 manager = Manager(app)
-
+import os
+DB = os.path.join(os.getcwd(),os.path.dirname(__file__),'db')
 @manager.command
 def init_db():
     "create all table in database"
     import sqlite3
-    con = sqlite3.connect('db')
+    con = sqlite3.connect(DB)
     con.cursor().executescript(open('py4u.sql','r').read())
     con.cursor().executescript(open('crawler/crawler.sql','r').read())
     con.commit()
     import datetime
     results = process()
     import sqlite3
-    con = sqlite3.connect('db')
+    con = sqlite3.connect(DB)
     c = con.cursor()
     for result in results:
         title,linker = result