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
# Redirect from www to nothing if not accepting domain name only | |
server { | |
server_name www.<domain-name>; | |
rewrite ^(.*) http://<domain-name>$1 permanent; | |
} | |
server { | |
listen 80; | |
server_name <domain-name>; | |
error_log /var/www/<mysitename>/logs/error.log; | |
root /var/www/<mysitename>/; |
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
description "uWSGI server for mysite.com" | |
start on runlevel 2 | |
stop on runlevel [016] | |
respawn | |
exec /usr/local/bin/uwsgi \ | |
--chdir=/var/www/mysite.com \ | |
--virtualenv=/var/www/mysite.com \ | |
--pythonpath=/var/www/mysite.com/mysiteproject \ | |
--socket 127.0.0.1:8888 \ | |
--env DJANGO_SETTINGS_MODULE=mysiteproject.settings.production \ |
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 os | |
from distutils.core import setup | |
from setuptools import find_packages | |
VERSION = __import__("cmsbase").VERSION | |
CLASSIFIERS = [ | |
'Framework :: Django', | |
'Intended Audience :: Developers', |
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
/* This code is licensed under Creative Commons Attribution 3.0 * | |
* You may share and remix the script so long as you attribute the * | |
* original author, Andrew January. * | |
* http://creativecommons.org/licenses/by/3.0/ */ | |
$(document).ready(function() { | |
// Check to see if the browser already supports placeholder text (introduced in HTML5). If it does, | |
// then we don't need to do anything. | |
var i = document.createElement('input'); | |
if ('placeholder' in i) { |
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
<div class="pagination"> | |
<ul> | |
<li {% if not partners.has_previous %}class="disabled"{% endif %}><a href="{% if partners.has_previous %}?page={{ partners.previous_page_number }}{% if category_filter %}&category={{category_filter.identifier}}{% endif %}{% endif %}">«</a></li> | |
{% for page in partners.paginator.page_range %} | |
<li {% if partners.number == page %}class="active"{% endif %}><a href="?page={{page}}{% if category_filter %}&category={{category_filter.identifier}}{% endif %}">{{page}}</a></li> | |
{% endfor %} | |
<li {% if not partners.has_next %}class="disabled"{% endif %}><a href="{% if partners.has_next %}?page={{ partners.next_page_number }}{% if category_filter %}&category={{category_filter.identifier}}{% endif %}{% endif %}">»</a></li> |
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.db import models | |
from django.utils.translation import ugettext_lazy as _ | |
from cmsbase.models import Page | |
class Testimonial(models.Model): | |
content = models.TextField(max_length=500) | |
author = models.CharField(max_length=100, blank=True, null=True) | |
related_to = models.ManyToManyField(Page, blank=True, null=True) | |
publish = models.BooleanField() |
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.contrib import admin | |
from django import forms | |
from django.utils.translation import ugettext_lazy as _ | |
from mptt.forms import TreeNodeMultipleChoiceField | |
from cmsbase.models import Page | |
from hollyfield.models import Testimonial |
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
<html> | |
<head> | |
<title>Welcome to our server</title> | |
<style> | |
body{ | |
font-family: Helvetica, Arial, sans-serif; | |
} | |
.message{ | |
width:330px; | |
padding:20px 40px; |
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 string | |
from random import choice | |
def generate_random_password(length=8, chars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", digits=string.digits, specials=u'!@$%&?'): | |
#raise Exception(string.letters) | |
password = u''.join([choice(unicode(digits)) for i in range(3)]) | |
password += u''.join([choice(unicode(chars.lower())) for i in range(3)]) | |
password += u''.join([choice(unicode(chars.upper())) for i in range(3)]) | |
password += u''.join([choice(specials) for i in range(1)]) | |
return password |