-
Notifications
You must be signed in to change notification settings - Fork 6
/
blog.py
executable file
·59 lines (49 loc) · 2.55 KB
/
blog.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
56
57
58
59
# this is the main entry point for the application
import os
import sys
import webapp2
PARENT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if PARENT_DIR not in sys.path:
sys.path.append(PARENT_DIR)
from gae_blog.controllers import admin, author, contact, error, feed, index, pingback, post, tag, trackback, verify, webmention
# url routes
BLOG_URLS = ['/blog']
ROUTES = []
for url in BLOG_URLS:
ROUTES.extend([(url, index.IndexController),
(url + '/feed', feed.FeedController),
(url + '/contact', contact.ContactController),
(url + '/post/(.[^/]+)', post.PostController),
(url + '/tag/(.[^/]+)', tag.TagController),
(url + '/author/(.[^/]+)', author.AuthorController),
(url + '/trackback/(.[^/]+)', trackback.TrackbackController),
(url + '/pingback', pingback.PingbackController),
(url + '/webmention', webmention.WebmentionController),
(url + '/verify', verify.VerifyController),
(url + '/admin', admin.AdminController),
(url + '/admin/blog', admin.BlogController),
(url + '/admin/author/(.*)', admin.AuthorController),
(url + '/admin/authors', admin.AuthorsController),
(url + '/admin/post/(.*)', admin.PostController),
(url + '/admin/posts', admin.PostsController),
(url + '/admin/preview/(.[^/]+)', admin.PreviewController),
(url + '/admin/comments', admin.CommentsController),
(url + '/admin/image', admin.ImageController),
(url + '/admin/images', admin.ImagesController),
(url + '/admin/migrate', admin.MigrateController),
(url + '/(.*)', error.ErrorController)
])
# any extra config needed when the app starts
config = {}
config['webapp2_extras.sessions'] = {
'secret_key': 'replace this with the output from os.urandom(64)',
'cookie_args': {
# uncomment this line to force cookies to only be sent over SSL
#'secure': True,
# 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
}
}
app = webapp2.WSGIApplication(ROUTES, config=config, debug=False)