GAE: 使用模板、清空本地数据库、时间

来源:互联网 发布:淘宝活动怎么参加 编辑:程序博客网 时间:2024/05/04 00:05
        self.template_values['user'] = self.user        self.response.headers['Cache-Control'] = 'max-age=0'        path = os.path.join(os.path.dirname(__file__), 'templates/index.html')        self.response.out.write(template.render(path, self.template_values))



清除开发服务器数据存储区

开发网络服务器使用本地版本的数据存储区以通过临时文件来测试应用程序。只要临时文件存在,数据就存在,并且网络服务器不会重设这些文件,除非您要求这样做。

如果您希望开发服务器在启动前清除其数据存储区,请在启动该服务器时使用 --clear_datastore 选项:

dev_appserver.py --clear_datastore helloworld/



    <div class='item'>        <h2>            {{post.title}}</h2>        <p>            {{post.timestamp|date:"Y-m-d H:i:s"}}</p>        <p>            {{post.body}}</p>    </div>

def formatDate(d):    return time.strftime("%Y-%m-%d %H:%M:%S", d)d = time.localtime()s = formatDate(d)print s



原创粉丝点击