This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from flask import Flask, jsonify, request, render_template, abort | |
from text.blob import TextBlob | |
from text.utils import strip_punc | |
app = Flask(__name__) | |
##### TextBlob API ##### | |
@app.route("/api/sentiment", methods=['POST']) | |
def sentiment(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python freeze.py | |
$ git init | |
$ git add . --all | |
$ git commit -am "Initial commit" | |
$ git checkout -b gh-pages | |
$ git remote add origin https://github.com/username/flask-ghpages-example.git | |
$ git push origin --all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from project import main | |
if __name__ == '__main__': | |
main.freezer.freeze() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends "base.html" %} | |
{% block content %} | |
<h1>{{ page.meta.title }}</h1> | |
<p>{{ page.meta.date }}</p> | |
{{ page }} | |
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
title: Bacon Ipsum | |
date: 2013-07-14 12:00:00 | |
Bacon ipsum dolor sit amet ball tip tongue pancetta jowl sirloin rump. Chuck tail pork cow, fatback jerky hamburger pancetta leberkas pig . | |
[Read more](http://baconipsum.com/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import render_template | |
from app import app, pages | |
@app.route('/') | |
def home(): | |
posts = [page for page in pages if 'date' in page.meta] | |
# Sort pages by date | |
sorted_posts = sorted(posts, reverse=True, | |
key=lambda page: page.meta['date']) | |
return render_template('index.html', pages=sorted_posts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import os | |
REPO_NAME = "flask-ghpages-example" # Used for FREEZER_BASE_URL | |
DEBUG = True | |
# Assumes the app is located in the same directory | |
# where this file resides | |
APP_DIR = os.path.dirname(os.path.abspath(__file__)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from flask import Flask | |
from flask_flatpages import FlatPages | |
from flask_frozen import Freezer | |
app = Flask(__name__) | |
app.config.from_pyfile('settings.py') | |
pages = FlatPages(app) | |
freezer = Freezer(app) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night-Eighties.tmTheme", | |
"draw_white_space": "all", | |
"font_face": "Ubuntu Mono", | |
"font_options": | |
[ | |
"subpixel_antialias" | |
], | |
"bold_folder_labels": true, | |
"caret_style": "phase", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Searching for lxml | |
Reading http://pypi.python.org/simple/lxml/ | |
Best match: lxml 3.2.1 | |
Downloading http://pypi.python.org/packages/source/l/lxml/lxml-3.2.1.tar.gz#md5=d183ccd6bbd5ca139e9db9e9a675787e | |
Processing lxml-3.2.1.tar.gz | |
Writing /tmp/easy_install-Pg78um/lxml-3.2.1/setup.cfg | |
Running lxml-3.2.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-Pg78um/lxml-3.2.1/egg-dist-tmp-083BG0 | |
Building lxml version 3.2.1. | |
Building without Cython. | |
Using build configuration of libxslt 1.1.24 |