Migrated to AppEngine Python 2.7
Posted by sky | Tags: Personal, Python, gae, testing
This site is now running on AppEngine Python 2.7 runtime. It is based on bloggart.
For reference, see AppEngine Migrating to Python 2.7.
After the migration, I regenerate the StaticContent via the remote-api shell.
python ~/py/gae/remote_api_shell.py -s timeless--sky.appspot.com
The remote-api shell keeps a history file .remote_api_shell_history in your home dir, so you can review what you have done.
The below code documents how the StaticContent is generated for each BlogPost and tag and archive:
1 import sys
2 sys.path.insert(0, 'lib')
3 import models
4 q = models.BlogPost.all()
5 q = q.order('-published')
6 posts = q.fetch(1000)
7 alltags = set()
8 from generators import PostContentGenerator
9 for post in posts:
10 if not post.path: continue
11 PostContentGenerator.generate_post(post)
12 alltags.update(post.normalized_tags)
13
14 from generators import BTagsContentGenerator
15 tags = list(alltags)
16 tags.sort()
17 for tag in tags:
18 BTagsContentGenerator.generate_resource(None, tag)
19
20 from generators import BArchivePageContentGenerator
21 q = models.BlogDate.all()
22 dates = q.fetch(None)
23 for d in dates:
24 BArchivePageContentGenerator.generate_resource(None, d.key().name())
25 for yr in (2012,2013):
26 BArchivePageContentGenerator.generate_resource(None, "%d/" % yr)
27
28 import post_deploy
29 post_deploy.post_deploy_tasks.pop() # ignore regenerate_all
30 post_deploy.post_deploy_tasks.pop()(None)
31
32 exit()
33
The remote-api is useful, since it is not possible to run a very long operation on the server unless you use the deferred tasks.
The Warning is you will use up your quota easily.
For my ref: the Google App admin: AppEngine link to replace the old one with the new service. Previous Post Next Post