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 datetime import datetime | |
while tempo >= 0: | |
if minuto > 59: | |
hora += 1 | |
minuto = 0 | |
if hora > 23: | |
dia += 1 | |
hora = 0 | |
if dia > dia_limite: | |
mes += 1 |
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 fabric file makes setting up and deploying a django application much | |
easier, but it does make a few assumptions. Namely that you're using Git, | |
Apache and mod_wsgi and your using Debian or Ubuntu. Also you should have | |
Django installed on your local machine and SSH installed on both the local | |
machine and any servers you want to deploy to. | |
_note that I've used the name project_name throughout this example. Replace | |
this with whatever your project is called._ |
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
====================================================== | |
Setting up Django using Apache/mod_wsgi on Ubuntu 8.10 | |
====================================================== | |
This article will cover setting up Django using Apache/mod_wsgi on Ubuntu | |
8.10. The article is targeted at a production environment, but keep in mind | |
this is a more generalized environment. You may have different requirements, | |
but this article should at least provide the stepping stones. | |
The article will use distribution packages where nesscary. As of 8.10 the |
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 import forms | |
from models import Pais | |
class MyForm(forms.Form): | |
pais = forms.ModelChoiceField(queryset = Pais.objects.all()) | |
def __init__(self, *args, **kwargs): |
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 | |
ROOT = os.path.dirname(os.path.abspath(__file__)) | |
join_root = lambda *x: os.path.join(ROOT, *x) | |
MEDIA_ROOT = join_root('media', 'uploads') | |
MEDIA_URL = '/upload/' | |
STATIC_ROOT = join_root('media', 'assets') |
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
# -*- encoding: utf-8 -*- | |
# Usage: | |
# urlpatterns += patterns('', | |
# route(r'^$', GET='getview', POST='postview', PUT='putview', DELETE='deleteview', name='viewname'), | |
# ) | |
# | |
from django.http import HttpResponseNotAllowed | |
from django.core.urlresolvers import RegexURLPattern, get_callable | |
def discover_view(view, prefix=''): |
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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 João Paulo Dubas <http://aval.io> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
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 hotshot | |
import os | |
import time | |
from django.conf import settings | |
try: | |
PROFILE_LOG_BASE = settings.PROFILE_LOG_BASE | |
except: | |
PROFILE_LOG_BASE = settings.ROOT |
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
git config --global alias.graph "log --graph --date-order -C -M --pretty=format:\"<%h> %ad [%an] %Cgreen%d%Creset %s\" --all --date=short" |
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
Show hidden characters
{ | |
"gocode_cmd": "/usr/local/bin/gocode", | |
"gofmt_cmd": "/usr/local/bin/gofmt", | |
"gslint_cmd": "/usr/local/bin/gotype", | |
"gstint_timeout": 500, | |
"gocode_accepts_character_offsets": false | |
} |
OlderNewer