Skip to content

Instantly share code, notes, and snippets.

@rafaelcaricio
rafaelcaricio / gist:659792
Created November 2, 2010 15:41
Instalando e iniciando o memcached
rafaelcaricio@ubuntu:~$ sudo apt-get install memcached
rafaelcaricio@ubuntu:~$ memcached -d -m 512 -l 127.0.0.1 -p 11211
@rafaelcaricio
rafaelcaricio / gist:659797
Created November 2, 2010 15:45
Verificando o status do memcached
rafaelcaricio@ubuntu:~$ ps ax | grep memcached
4185 ? Ssl 0:00 memcached -d -m 512 -l 127.0.0.1 -p 11211
@rafaelcaricio
rafaelcaricio / gist:659798
Created November 2, 2010 15:46
Instalando o NGINX
rafaelcaricio@ubuntu:~$ sudo apt-get install nginx
@rafaelcaricio
rafaelcaricio / gist:659799
Created November 2, 2010 15:47
Instalando o suporte ao memcached ao python e instalando o Green Unicorn
rafaelcaricio@ubuntu:~$ sudo easy_install python-memcached
rafaelcaricio@ubuntu:~$ sudo easy_install gunicorn
@rafaelcaricio
rafaelcaricio / gist:659806
Created November 2, 2010 15:48
Parando e iniciando o NGINX
rafaelcaricio@ubuntu:~$ sudo /etc/init.d/nginx stop
Stopping nginx: nginx.
rafaelcaricio@ubuntu:~$ sudo /etc/init.d/nginx start
Starting nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
configuration file /etc/nginx/nginx.conf test is successful
nginx.
@rafaelcaricio
rafaelcaricio / gist:659809
Created November 2, 2010 15:49
Configurando o NGINX
rafaelcaricio@ubuntu:~$ sudo vim /etc/nginx/sites-available/easyproject.conf
@rafaelcaricio
rafaelcaricio / gist:659815
Created November 2, 2010 15:51
Configuração do NGINX
upstream easy_gunicorn {
server 127.0.0.1:9000;
}
server {
listen 80;
server_name localhost 127.0.0.1;
client_max_body_size 10M;
access_log /var/log/nginx/easyproject.access.log;
@rafaelcaricio
rafaelcaricio / gist:659891
Created November 2, 2010 16:25
processo morrendo.
*** HARAKIRI ON WORKER 2 (pid: 13221) ***
HARAKIRI: --- uWSGI worker 2 (pid: 13221) WAS managing request /estudante/ since Tue Nov 2 13:24:09 2010 ---
DAMN ! process 13221 died :( trying respawn ...
Respawned uWSGI worker (new pid: 13235)
@rafaelcaricio
rafaelcaricio / gunicorn.conf.py
Created November 2, 2010 18:01
Configurações do gunicorn
#!/usr/bin/python
import sys
import os
from django.conf import settings
try:
import settings # Assumed to be in the same directory.
sys.path.insert(0, os.path.join(settings.PROJECT_ROOT, "apps"))
except ImportError:
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
sys.exit(1)
@rafaelcaricio
rafaelcaricio / middleware.py
Created November 2, 2010 18:08
Middleware que atualiza o cache.
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import re
from django.core.cache import cache
from django.conf import settings
class NginxCacheMiddleware:
def process_response(self, request, response):
cacheIt = True