Skip to content

Instantly share code, notes, and snippets.

@ronbeltran
Last active December 30, 2015 02:49
Show Gist options
  • Save ronbeltran/7764831 to your computer and use it in GitHub Desktop.
Save ronbeltran/7764831 to your computer and use it in GitHub Desktop.
Command line Kung Fu
To update appengine project on system with multiple accounts:
appcfg.py --no_cookies update <appname>
#For Postgres
initdb /usr/local/var/postgres -E utf8 # create a database cluster
postgres -D /usr/local/var/postgres # serve that database
PGDATA=/usr/local/var/postgres postgres # …alternatively
If builds of PostgreSQL 9 are failing and you have version 8.x installed,
you may need to remove the previous version first. See:
https://github.com/mxcl/homebrew/issues/issue/2510
To migrate existing data from a previous major version (pre-9.3) of PostgreSQL, see:
http://www.postgresql.org/docs/9.3/static/upgrading.html
When installing the postgres gem, including ARCHFLAGS is recommended:
ARCHFLAGS="-arch x86_64" gem install pg
To install gems without sudo, see the Homebrew wiki.
To have launchd start postgresql at login:
mkdir -p ~/Library/LaunchAgents
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
Then to load postgresql now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Or, if you don't want/need launchctl, you can just run:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
# For SQLAlchemy
from sqlalchemy.orm import scoped_session, sessionmaker
from models import engine
db = scoped_session( sessionmaker(bind=engine) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment