run server if main, cleanup
This commit is contained in:
10
server.py
10
server.py
@@ -4,9 +4,6 @@ import json
|
||||
import anydbm as dbm
|
||||
import os
|
||||
|
||||
if (os.path.dirname(__file__) != ""):
|
||||
os.chdir(os.path.dirname(__file__))
|
||||
|
||||
data = dbm.open("cryptopad.db", 'c');
|
||||
|
||||
@get("/storage/<key>")
|
||||
@@ -25,8 +22,8 @@ def delete(key):
|
||||
def set(key):
|
||||
data[key] = request.forms.get("value")
|
||||
|
||||
@route('/<filepath:path>')
|
||||
def server_static(filepath):
|
||||
@get("/<filepath:path>")
|
||||
def mystatic(filepath):
|
||||
return static_file(filepath, root='static')
|
||||
|
||||
@route('/')
|
||||
@@ -34,3 +31,6 @@ def index():
|
||||
return static_file("cryptopad.html", root='static')
|
||||
|
||||
application=default_app()
|
||||
|
||||
if __name__ == "__main__":
|
||||
run(application, host='localhost', port=55580)
|
||||
|
||||
Reference in New Issue
Block a user