This file contains hidden or 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 boto | |
| django_cache | |
| cs_conn = boto.connect_cloudsearch( | |
| aws_access_key_id=YOUR_KEY_ID, | |
| aws_secret_access_key=YOUR_ACCESS_KEY, | |
| ) | |
| search_kwargs = {} | |
| search_kwargs['q'] = "Stuff to find" |
This file contains hidden or 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
| BotoServerError: BotoServerError: 400 Bad Request | |
| <ErrorResponse xmlns="http://cloudsearch.amazonaws.com/doc/2011-02-01/"> | |
| <Error> | |
| <Type>Sender</Type> | |
| <Code>Throttling</Code> | |
| <Message>Rate exceeded</Message> | |
| </Error> | |
| <RequestId>c553f43e-26b9-11e3-a879-0d3b8f7ade72</RequestId> | |
| </ErrorResponse> |
This file contains hidden or 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
| <VirtualHost *:80> | |
| RewriteEngine On | |
| RewriteRule ^.*$ /path/to/your/temp_down_page.html | |
| </VirtualHost> |
This file contains hidden or 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.contrib.auth import get_user_model | |
| User = get_user_model() | |
| admin.site.register(User) |
This file contains hidden or 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
| class CustomUserManager(CustomUserManager): | |
| def create_user(self, email, | |
| password=None): | |
| user = self.model(email=email, password=password) | |
| user.set_password(password) | |
| user.save(using=self._db) | |
| return user | |
| def create_superuser(self, email, | |
| password): |
This file contains hidden or 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.contrib.auth.models import AbstractBaseUser, BaseUserManager, PermissionsMixin | |
| class CustomUser(AbstractBaseUser, PermissionsMixin): | |
| email = models.EmailField(unique=True) | |
| website_url = models.URLField(max_length=255) | |
| is_active = models.BooleanField(default=True) | |
| is_staff = models.BooleanField(default=False) | |
| is_admin = models.BooleanField(default=False) | |
| USERNAME_FIELD = "email" |
This file contains hidden or 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 celery.task import task | |
| @task | |
| def my_asyncronous_task(stuff_to_print): | |
| print stuff_to_print | |
| my_asyncronous_task.apply_async((stuff_to_print,), expires=7200) |
This file contains hidden or 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 celery.task import task | |
| @task(expires=7200) | |
| def my_asyncronous_task(stuff_to_print): | |
| print stuff_to_print | |
| my_asyncronous_task.delay(stuff_to_print) |
This file contains hidden or 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
| <div id="linkbait"> | |
| <h2>Add a badge to your website</h2> | |
| <p>Copy and paste HTML code below and paste it into your website editor.</p> | |
| <textarea id="html-code" rows="4" cols="60"> </textarea> | |
| <p><strong>Preview:</strong></p> | |
| <div id="preview"> | |
| </div> | |
| <p> | |
| <input type="button" onclick="build_seo_badge();" value="Get New Badge Code"> |
This file contains hidden or 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
| function sendRequestToRecipients() { | |
| FB.ui({method: 'apprequests', | |
| new_style_message: true, | |
| message: 'wants you to check out something AMAZING in', | |
| to: '499802820' | |
| }, requestCallback); | |
| } |
NewerOlder