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
[rcasecret vagrant]$ python manage.py test rcasecret -v3 | |
/home/vagrant/.virtualenvs/rcasecret/local/lib/python2.7/site-packages/django/db/models/fields/subclassing.py:22: RemovedInDjango110Warning: SubfieldBase has been deprecated. Use Field.from_db_value instead. | |
RemovedInDjango110Warning) | |
Creating test database for alias 'default' ('test_rcasecret')... | |
Got an error creating the test database: database "test_rcasecret" already exists | |
Type 'yes' if you would like to try deleting the test database 'test_rcasecret', or 'no' to cancel: yes | |
Destroying old test database for alias 'default' ('test_rcasecret')... | |
Operations to perform: |
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 django.utils import timezone | |
from wagtail.wagtailsearch.backends.elasticsearch import ElasticSearch, ElasticSearchQuery | |
from wagtail.wagtailcore.models import Page | |
from wagtail.wagtailimages.models import AbstractImage | |
from wagtail.wagtaildocs.models import Document | |
class ElasticSearchQueryWithRecency(ElasticSearchQuery): |
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
> EXPLAIN SELECT <cut> FROM `wagtailcore_pagerevision` INNER JOIN `wagtailcore_page` ON ( `wagtailcore_pagerevision`.`page_id` = `wagtailcore_page`.`id` ) LEFT OUTER JOIN `auth_user` ON ( `wagtailcore_pagerevision`.`user_id` = `auth_user`.`id` ) WHERE `wagtailcore_pagerevision`.`submitted_for_moderation` = TRUE ORDER BY `wagtailcore_pagerevision`.`created_at` DESC; | |
+----+-------------+--------------------------+--------+------------------------------------------------------------------+------------------------------------------------------------------+---------+-----------------------------------------+--------+----------------------------------------------+ | |
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | | |
+----+-------------+--------------------------+--------+-- |
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 distutils.version import StrictVersion | |
from urllib.request import urlopen | |
import json | |
from collections import OrderedDict | |
# Get list of versions from pypi | |
pypi = json.loads(urlopen('https://pypi.python.org/pypi/wagtail/json').read().decode('utf-8')) | |
versions = [StrictVersion(v) for v in pypi['releases'].keys()] | |
# Filter out prereleases (betas, alphas, etc) |
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
# HTTPS youtube embeds for wagtail | |
# Put this file in your project and add the following to your settings: | |
# WAGTAILEMBEDS_EMBED_FINDER = 'myapp.embeds.custom_embed_finder' | |
import json | |
import re | |
from six.moves.urllib.request import Request, urlopen | |
from six.moves.urllib.error import URLError |
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 wagtail.wagtailsearch.backends import get_search_backend | |
from wagtail.wagtailsearch.backends.elasticsearch import ElasticSearchResults | |
from wagtail.wagtailcore.models import Page | |
s = get_search_backend() | |
class AwesomeQuery(object): | |
def __init__(self, search_query, campaigns, languages, |
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
# Configuration from environment variables | |
# Alternatively, you can set these in a local.py file on the server | |
# Using a ChainMap makes writes go to a new dict and lookups check both | |
from collections import ChainMap | |
env = ChainMap(dict(), os.environ) | |
# On Torchbox servers, many environment variables are prefixed with "CFG_" | |
for key, value in os.environ.items(): | |
if key.startswith('CFG_'): |
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 wagtail.wagtailsearch.backends import get_search_backend | |
from wagtail.wagtailsearch.backends.elasticsearch import ElasticSearchResults | |
class AwesomeQuery(object): | |
def __init__(self, search_query, campaign, country, language): | |
self.search_query = search_query | |
self.campaign = campaign | |
self.country = country | |
self.language = language |
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
## Openbox autostart.sh | |
## ==================== | |
## When you login to your CrunchBang Openbox session, this autostart script | |
## will be executed to set-up your environment and launch any applications | |
## you want to run at startup. | |
## | |
## Note*: some programs, such as 'nm-applet' are run via XDG autostart. | |
## Run '/usr/lib/openbox/openbox-xdg-autostart --list' to list any | |
## XDG autostarted programs. | |
## |
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
#--------------------------------------------- | |
# TINT2 CONFIG FILE | |
#--------------------------------------------- | |
# For more information about tint2, see: | |
# http://code.google.com/p/tint2/wiki/Welcome | |
# | |
# For more config file examples, see: | |
# http://crunchbanglinux.org/forums/topic/3232/my-tint2-config/ | |
# Background definitions |