-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.py
39 lines (33 loc) · 967 Bytes
/
index.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import urllib
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from main import *
from login import *
from verify import *
from tryfollow import *
urllib.getproxies_macosx_sysconf = lambda: {} # Hack for OSX.
application = webapp.WSGIApplication([
("/", MainPage),
("/login", LoginPage),
("/verify", VerifyPage),
("/tryfollow", TryFollowPage)
], debug=True)
def real_main():
run_wsgi_app(application)
def profile_main():
# This is the main function for profiling
# We've renamed our original main() above to real_main()
import cProfile, pstats
prof = cProfile.Profile()
prof = prof.runctx("real_main()", globals(), locals())
print "<pre>"
stats = pstats.Stats(prof)
stats.sort_stats("time") # Or cumulative
stats.print_stats(80) # 80 = how many to print
# The rest is optional.
# stats.print_callees()
# stats.print_callers()
print "</pre>"
main = real_main
if __name__ == "__main__":
main()