Skip to content

Instantly share code, notes, and snippets.

View rmax's full-sized avatar
:octocat:
ヾ(⌐■_■)ノ♪

R Max Espinoza rmax

:octocat:
ヾ(⌐■_■)ノ♪
View GitHub Profile
"""
Based on
http://www.bitbucket.org/mitsuhiko/jinja2-main/src/tip/ext/djangojinja2.py
"""
import jinja2
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.template import TemplateDoesNotExist
from django.template.loader import BaseLoader
function! EnableVirtualEnv()
python << EOF
import vim
import os
import sys
if 'VIRTUAL_ENV' in os.environ:
vim.command('let g:virtualenv_found = 1')
# enable virtualenv environment within vimruntime
activate_this = os.path.join(os.environ['VIRTUAL_ENV'], 'bin/activate_this.py')
if os.path.isfile(activate_this):
# HG changeset patch
# Parent b83d4a597f5fefe33a4eb0a7a4d4027402140870
# User Rolando Espinoza La fuente <[email protected]>
diff --git a/django/test/testcases.py b/django/test/testcases.py
--- a/django/test/testcases.py
+++ b/django/test/testcases.py
@@ -7,7 +7,7 @@ from django.conf import settings
from django.core import mail
from django.core.management import call_command
from scrapy.spider import BaseSpider
from scrapy.http import FormRequest, Request
from scrapy.selector import HtmlXPathSelector
class DjangoSpider(BaseSpider):
domain_name = "django.local"
start_urls = ["http://localhost:8000/admin/"]
extra_domain_names = ["localhost"]
def parse(self, response):
diff --git a/django/contrib/sites/management.py b/django/contrib/sites/management.py
index 1987274..40f93ae 100644
--- a/django/contrib/sites/management.py
+++ b/django/contrib/sites/management.py
@@ -8,9 +8,15 @@ from django.contrib.sites import models as site_app
def create_default_site(app, created_models, verbosity, db, **kwargs):
if Site in created_models:
+ domain = "example.com"
+ if kwargs.get('interactive', True):
from scrapy.core import signals
from scrapy import log
from scrapy.xlib.pydispatch import dispatcher
import time
class ElapsedTimeMiddleware(object):
def __init__(self):
self._registry = {}
dispatcher.connect(self.spider_opened, signal=signals.spider_opened)
cookies = {}
for cs in response.headers['set-cookie'].split(';'):
data = cs.split('=')
cookies[data[0]] = data[1] if len(data) > 1 else data[0]
sessid = cookies['PHPSESSID']
# Django settings for myproject project.
import os
import sys
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', '[email protected]'),
)
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE myproject.settings
PythonDebug On
PythonPAth "['/home/darkrho/django_sites'] + sys.path"
from __future__ import with_statement # python2.5
"""
Project root holds virtual environment
"""
from fabric.api import *
import os.path
# globals
env.project_name = 'myproject'