From f326218adc2ce56a2294c494cc8163db1463dcdb Mon Sep 17 00:00:00 2001 From: dsc Date: Fri, 23 Dec 2011 02:41:25 -0800 Subject: [PATCH] install instructions --- .gitignore | 21 ++++++++++----------- README.md | 30 +++++++++++++++++++++++++++--- crisishaiku/__init__.py | 23 +++++++++++++++++++++++ etc/flask-dev.cfg | 2 ++ etc/flask-prod.cfg | 2 ++ etc/flask.cfg | 2 ++ setup.py | 34 +++++++++++++++++++++++----------- 7 files changed, 89 insertions(+), 25 deletions(-) create mode 100644 etc/flask-dev.cfg create mode 100644 etc/flask-prod.cfg create mode 100644 etc/flask.cfg diff --git a/.gitignore b/.gitignore index 6fe101c..dd1e969 100644 --- a/.gitignore +++ b/.gitignore @@ -9,15 +9,14 @@ Icon? pip-log.txt *.py[oc] *.egg-info +.tox/ +.coverage +.coverage_html +*.un~ +docs/_build/* +.env/ +build/ +dist/ -node_modules/ -node_modules/* -npm-debug.log -*.sass-cache -lib-cov -test/*.log -test/fixtures/*.json -test/fixtures/logs/*.log - -tmp -var +tmp/ +var/ diff --git a/README.md b/README.md index 9681dc1..f7886d2 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,37 @@ # Financial Crisis Haiku +A website dedicated to the poetry of financial disaster~ + + ## Install -As usual: +First up, `virtualenv`: + + virtualenv --no-site-packages --distribute .env + . .env/bin/activate + +Then install the egg: pip install -e . -Once that's done, go find tha PyHyphen package directory and copy etc/hyph_en_US.dic into it. -Unfortunately, OpenOffice.org has 404'd their dictionary files, so we have to do this manually. + +**OPTIONAL** + +This isn't needed to hack on the site. + +If you want to run the haiku-finder yourself, you'll need to deal with PyHyphen. +Unfotunately, it attempts to download a dictionary file from OpenOffice.org, and +they appear to have 404'd it. + +If we list PyHyphen as a dependency directly the whole chain will fail. But it +turns out the install works fine by itself, even though you'll get a messy error +about the missing dictionaries. + + pip install PyHyphen + +Finally, let's fix the missing dict (which I dug up from somewhere). + + cp etc/hyph_en_US.dic .env/lib/python2.7/site-packages/hyphen/ ## Features diff --git a/crisishaiku/__init__.py b/crisishaiku/__init__.py index 66cec86..6fb6235 100644 --- a/crisishaiku/__init__.py +++ b/crisishaiku/__init__.py @@ -1,6 +1,29 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +""" crisishaiku.com -- a website dedicated to the poetry of financial disaster +""" __version__ = '0.0.1' VERSION = tuple(map(int, __version__.split('.'))) + +from flask import (Flask, + request, session, g, redirect, url_for, + abort, render_template, flash, ) +from flaskext.sqlalchemy import SQLAlchemy + + +app = Flask('crisishaiku') + +### Config +# Load from any ALL_CAPS variables in this file +app.config.from_object('crisishaiku') +# Load from our base config file +app.config.from_pyfile('etc/flask.cfg') +# Load any overrides from the file specified in the env var FLASK_SETTINGS +app.config.from_envvar('FLASK_SETTINGS', silent=True) + +db = SQLAlchemy(app) + + + diff --git a/etc/flask-dev.cfg b/etc/flask-dev.cfg new file mode 100644 index 0000000..05da8d1 --- /dev/null +++ b/etc/flask-dev.cfg @@ -0,0 +1,2 @@ +DEBUG = True +SQLALCHEMY_ECHO = True diff --git a/etc/flask-prod.cfg b/etc/flask-prod.cfg new file mode 100644 index 0000000..b82f6b6 --- /dev/null +++ b/etc/flask-prod.cfg @@ -0,0 +1,2 @@ +DEBUG = False +SQLALCHEMY_ECHO = False diff --git a/etc/flask.cfg b/etc/flask.cfg new file mode 100644 index 0000000..610212a --- /dev/null +++ b/etc/flask.cfg @@ -0,0 +1,2 @@ +SQLALCHEMY_DATABASE_URI = 'sqlite:///var/haikus.db' + diff --git a/setup.py b/setup.py index 1f3c430..50bf0c1 100644 --- a/setup.py +++ b/setup.py @@ -1,18 +1,24 @@ -#!/usr/bin/env python +#!python # -*- coding: utf-8 -*- -from setuptools import setup, find_packages +import re from os.path import dirname, abspath, join - -from crisishaiku import __version__ +from setuptools import setup, find_packages HERE = abspath(dirname(__file__)) readme = open(join(HERE, 'README.md'), 'rU').read() +package_file = open(join(HERE, 'crisishaiku/__init__.py'), 'rU') +__version__ = re.sub( + r".*\b__version__\s+=\s+'([^']+)'.*$", + r'\1', + [ line.strip() for line in package_file if '__version__' in line ].pop(0) +) + setup( name = 'crisishaiku', version = __version__, - description = 'crisishaiku.com website', + description = 'a website dedicated to the poetry of financial disaster', long_description = readme, url = 'http://crisishaiku.com/', @@ -23,11 +29,17 @@ setup( # entry_points = { 'console_scripts':['crisishaiku = crisishaiku:CrisisHaiku.main'] }, install_requires = [ - 'PyHyphen >= 1.0beta1', - 'jsonlib2 >= 1.5.2', - 'anyjson >= 0.3.1', - 'bunch >= 1.0', - 'PyYAML >= 3.10', + # 'PyHyphen >= 1.0beta1', + 'bunch >= 1.0', + 'jsonlib2 >= 1.5.2', + 'anyjson >= 0.3.1', + 'PyYAML >= 3.10', + + 'Flask >= 0.8', + 'Flask-SQLAlchemy >= 0.15', + + 'pyjade >= 0.6', + 'pystache >= 0.3.1', ], keywords = 'crisishaiku crisis haiku poetry web', @@ -35,7 +47,7 @@ setup( "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", - "Topic :: Utilities" + "Topic :: Utilities", "Topic :: Software Development :: Libraries :: Python Modules", "Programming Language :: Python", "Programming Language :: Python :: 2.6", -- 1.7.0.4