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
# https://groups.google.com/forum/?fromgroups#!topic/django-brasil/d6gV1V9qrgU | |
from django.forms import ModelForm | |
from minha_app.models import MeuModel | |
class MeuForm(ModelForm): | |
class Meta: | |
model = MeuModel |
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
SetEnvIf Origin "^http(s)?://(.+\.)?(http://ANY_DOMAIN_HERE\.com)$" origin_is=$0 | |
Header always set Access-Control-Allow-Origin %{origin_is}e env=origin_is |
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.views.generic import View | |
from django.template.response import TemplateResponse | |
from news.models import Noticia | |
from videos.models import Video | |
from datetime import datetime | |
class HomeView(View): | |
template_name = 'home/home.html' |
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
""" | |
Resposta que surgiu nesta discussão: https://groups.google.com/forum/#!topic/django-brasil/3ADhmbltSUU | |
Então guardei aqui p/ testar em breve. | |
""" | |
Model.objects.using(Model.user_db(user)).all() ou | |
instance.save(using=Model.user_db(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
from splinter.browser import Browser | |
browser = Browser('chrome') | |
browser.visit('http://google.com') | |
browser.fill('q', 'splinter - python acceptance testing for web applications') | |
browser.find_by_name('btnG').first.click() | |
if browser.is_text_present('splinter.cobrateam.info'): | |
print "Yes, the official website was found!" | |
else: |
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
ps ax|grep gunicorn |
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 the terminal open the file environment | |
$: sudo gedit /etc/environment | |
#Insert the line at the botton of the file | |
UNITY_FORCE_START=1 |
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
ps -u username -o rss,command | grep -v peruser | awk '{sum+=$1} END {print sum/1024}' |
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
#Se o erro for algo parecido com isto: | |
#building 'lxml.etree' extension | |
#gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -w | |
#In file included from src/lxml/lxml.etree.c:239:0: | |
#src/lxml/etree_defs.h:9:31: erro fatal: libxml/xmlversion.h: Arquivo ou diretório não encontrado | |
#compilação terminada. | |
#error: command 'gcc' failed with exit status 1 | |
#basta instalar libxml2-dev e libxslt-dev |
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
#INSTALL | |
sudo add-apt-repository ppa:gloobus-dev/gloobus-preview | |
sudo apt-get update | |
sudo apt-get install gloobus-preview gloobus-sushi | |
#For the oppenoffice documents to work, you should install unoconv too | |
sudo apt-get install unoconv |