Ejemplo n.º 1
0
        # mypage 表示
        (r"/mypageUser", UserMyPageHandler),
        (r"/mypageArtist", ArtistMyPageHandler),

        # search
        (r"/search", SearchHandler),
        # searchResults
        (r"/searchResults", SearchResultsHandler),
    ],
    template_path=os.path.join(os.getcwd(), "templates"),
    static_path=os.path.join(os.getcwd(), "static"),
    # cookieの暗号化キー(システムごとにランダムな文字列を設定する)
    cookie_secret="x-D-#i&0S?R6w9qEsZB8Vpxw@&t+B._$",
)

if __name__ == "__main__":
    args = sys.argv
    if len(args) > 1:
        if args[1] == "migrate":
            user.migrate()
        if args[1] == "db_cleaner":
            user.db_cleaner()
        if args[1] == "help":
            print("usage: python server.py migrate # prepare DB")
            print("usage: python server.py db_cleaner # remove DB")
            print("usage: python server.py # run web server")
    else:
        application.listen(3000, "0.0.0.0")
        tornado.ioloop.IOLoop.instance().start()
Ejemplo n.º 2
0
 def tearDown(self):
     user.db_cleaner()
     self.patcher.stop()