This document has now been incorporated into the uWSGI documentation:
http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html
Steps with explanations to set up a server using:
import os, hashlib, urllib2, optparse | |
def get_remote_md5_sum(url, max_file_size=100*1024*1024): | |
remote = urllib2.urlopen(url) | |
hash = hashlib.md5() | |
total_read = 0 | |
while True: | |
data = remote.read(4096) | |
total_read += 4096 |
#!/bin/sh | |
# http://nathanvangheem.com/news/gunicorn-startup-script-for-django | |
# Place the script in the file - /etc/init.d/gunicorn or whatever you'd like to call it | |
# make it executable - chmod +x /etc/init.d/gunicorn | |
# And finally, wire it up - update-rc.d gunicorn defaults | |
ADDRESS='127.0.0.1' | |
PYTHON="/opt/django/bin/python" | |
GUNICORN="/opt/django/bin/gunicorn_django" |
/* | |
* Fabrizio Calderan, twitter @fcalderan, 2010.11.02 | |
* I had an idea: could Inception movie be explained by a few javascript closures | |
* and variable resolution scope (just for fun)? | |
* | |
* Activate javascript console =) | |
*/ | |
<script> | |
console.group("inception movie"); |
import email | |
def get_decoded_email_body(message_body): | |
""" Decode email body. | |
Detect character set if the header is not set. | |
We try to get text/plain, but if there is not one then fallback to text/html. | |
:param message_body: Raw 7-bit message body input e.g. from imaplib. Double encoded in quoted-printable and latin-1 |
def validate_count(obj): | |
model = obj.__class__ | |
if model.objects.count() >= 8: | |
raise ValidationError('You can add only 8 slider objects %s' % model.__name__) | |
class Slider(models.Model): | |
# Model fields | |
def clean(self): | |
validate_count(self) |
var arr = [{id:3,title:"Ali"},{id:3,title:"Veli"},{id:3,title:"Vehbi"}]; | |
arr.sort(turkcesiralama); | |
function turkcesiralama(a, b){ | |
var atitle = a.title; | |
var btitle = b.title; | |
var alfabe = "AaBbCcÇçDdEeFfGgĞğHhIıİiJjKkLlMmNnOoÖöPpQqRrSsŞşTtUuÜüVvWwXxYyZz0123456789"; | |
if (atitle.length === 0 || btitle.length === 0) { | |
return atitle.length - btitle.length; | |
} |
In this tutorial we are going to build a Twitter clone using Django and GetStream.io, a hosted API for newsfeed development.
We will show you how easy is to power your newsfeeds with GetStream.io. For brevity we leave out some basic Django-specific code and recommend you refer you to the Github project for the complete runnable source code. At the end of this tutorial we will have a Django app with a profile feed, a timeline feed, support for following users, hashtags and mentions.
I assume that you are familiar with Django. If you're new to Django the [official tutorial] (https://docs.djangoproject.com/en/2.0/intro/) explains it very well.