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 | |
import simplejson | |
import logging | |
import random | |
import re | |
import datetime | |
import string | |
import time | |
import sys | |
import urllib |
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
"""Implementation of JSONEncoder | |
""" | |
from __future__ import absolute_import | |
import re | |
from operator import itemgetter | |
from decimal import Decimal | |
from .compat import u, unichr, binary_type, string_types, integer_types, PY3 | |
def _import_speedups(): | |
try: | |
from . import _speedups |
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
import json, psycopg2 | |
vcap_services = json.loads(os.environ['VCAP_SERVICES']) | |
postgres_srv = vcap_services['postgresql-9.1'][0] | |
try: | |
cred = postgres_srv['credentials'] | |
except KeyError,ke: | |
print >> sys.stderr, "VCAP_SERVICES = %s" % str(vcap_services) | |
raise ke | |
DATABASES = { |
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 | |
import smtplib | |
import sys | |
from optparse import OptionParser | |
def initialize_smtp_server(smtpserver, smtpport, email, pwd): | |
''' | |
This function initializes and greets the SMTP server. | |
It logs in using the provided credentials and returns the |
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 fabric.api import env, run, sudo, local, put | |
def production(): | |
"""Defines production environment""" | |
env.user = "deploy" | |
env.hosts = ['example.com',] | |
env.base_dir = "/var/www" | |
env.app_name = "app" | |
env.domain_name = "app.example.com" | |
env.domain_path = "%(base_dir)s/%(domain_name)s" % { 'base_dir':env.base_dir, 'domain_name':env.domain_name } |
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 | |
#-*- coding:UTF-8 -*- | |
from fabric.api import env, run, sudo, local, put | |
def production(): | |
"""Defines production environment""" | |
env.user = "deploy" | |
env.hosts = ['example.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
# -*- coding: utf-8 -*- | |
from celery.task import task | |
@task | |
def generate(model, pk, attr): | |
instance = model._default_manager.get(pk=pk) | |
file = getattr(instance, attr) | |
file.generate(save=True) | |
return attr |
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 __future__ import with_statement | |
from datetime import datetime | |
from sys import exit | |
from fabric.api import env, run, local, task, settings, sudo | |
import re | |
env.hosts = ['[email protected]'] | |
environments = { | |
'__base__': { |
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
import fabric.api as api | |
with api.env_shell("PYTHONPATH=. DJANGO_SETTINGS_MODULE=settings.imagawa"): | |
api.run("python dosomething.py") |
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 fabric.context_managers import cd | |
from fabric.operations import sudo,run,local | |
from fabric.state import env | |
env.hosts = ['127.0.0.1',] | |
env.user = 'username' | |
env.deploy_user = 'django' | |
env.key_filename = ['/Users/soyrex/Keys/keyfile.pem',] | |
def stage(): | |
local('git push origin staging') |
OlderNewer