python - Why doesn't bottlepy server load? -
i confused why bottlepy server doesn't run:
if __name__ == '__main__': start = datetime.now() db = database(force_refresh_cache=false, timestamp_filename='timestamp.pickle', schema_filename='schema.pickle') print datetime.now(), 'took:', (datetime.now() - start).total_seconds() run(host='localhost', port=80, reloader=true, debug=true)
when comment out db construction; server runs.
in both cases timestamped "took: [seconds]" line, implies no error occurred earlier.
the problem module level code, , potentially fact using reloader switch. check this out.
all module level code run @ least twice when reloader on. haven't tested this, make sense wouldn't able spawn child if db tied up.
try this:
if __name__ == '__main__': start = datetime.now() db = database(force_refresh_cache=false, timestamp_filename='timestamp.pickle', schema_filename='schema.pickle') print datetime.now(), 'took:', (datetime.now() - start).total_seconds() run(host='localhost', port=80, debug=true)
Comments
Post a Comment