-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.py
executable file
·55 lines (47 loc) · 1.93 KB
/
app.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# this is the main entry point for the application
import os
import webapp2
from config.constants import SESSION_KEY
# URL routes
from controllers import admin, api, dev, error, home, index, job, sitemap, static, user
ROUTES = [
('/', index.IndexController),
('/home', home.HomeController),
('/user', user.IndexController),
('/user/auths', user.AuthsController),
('/user/email', user.EmailController),
('/user/password', user.PasswordController),
('/user/signup', user.SignupController),
('/user/login', user.LoginController),
('/user/logout', user.LogoutController),
('/user/forgotpassword', user.ForgotPasswordController),
('/user/resetpassword', user.ResetPasswordController),
('/terms', static.StaticController),
('/privacy', static.StaticController),
('/sitemap.xml', sitemap.SitemapController),
('/admin', admin.AdminController),
('/api/upload', api.UploadController),
('/dev', dev.DevController),
('/job/auths', job.AuthsController),
('/job/email', job.EmailController),
# ('/errors/(.*)', static.StaticController), # uncomment to test static error pages
('/logerror', error.LogErrorController),
('/policyviolation', error.PolicyViolationController),
('/(.*)', error.ErrorController)
]
# any extra config needed when the app starts
cookie_args = {
# this can prevent XSS attacks by not letting javascript access the cookie
# (note that some older browsers do not have this restriction implemented)
# disable if you need to access cookies from javascript (not recommended)
'httponly': True
}
if not os.environ.get('SERVER_SOFTWARE', '').startswith('Development'):
# force cookies to only be sent over SSL
cookie_args['secure'] = True
config = {'webapp2_extras.sessions': {
'secret_key': SESSION_KEY,
'cookie_args': cookie_args
}}
# make sure debug is False for production
app = webapp2.WSGIApplication(ROUTES, config=config, debug=False)