Create a websites
user.
sudo adduser --disabled-password --home /src/websites websites
Login and install dropbox.
sudo -s su - websites
# Solo permite acceder a quienes dan el token correcto | |
SetEnvIf Authorization "^Token QprcGo242MmjsB1ZoCwAq5EYs5e9Mjsnj1gug3YBxAIIE6of$" HTTP_SAFE_USE=1 | |
Order Deny,Allow | |
Deny from All | |
Allow from env=HTTP_SAFE_USE | |
# No permite que ninguna respuesta sea cacheada | |
Header unset ETag | |
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" | |
Header set Pragma "no-cache" |
from django.db import models | |
from .workflow import Workflow, StateField | |
class SaleOrder(Workflow, models.Model): | |
DRAFT = 'draft' | |
QUOTATION = 'quotation' | |
CONFIRMED = 'confirmed' |
__version__ = "0.1" | |
__author__ = "mariocesar" | |
def get_module_meta(module_path): | |
import re | |
with open(module_path) as cakebet_meta: | |
meta = cakebet_meta.read() | |
return dict(re.findall('(?P<key>__.+__)\s=\s["\' ](?P<value>.+)["\' ]', meta)) |
class RequestLogMiddleware(object): | |
""" | |
Log requests to the application, a simple wsgi middleware. | |
""" | |
def __init__(self, application): | |
self.application = application | |
def __call__ (self, environ, start_response): |
import os | |
index_tpl = open('index.html', 'r').read() | |
def application(environ, response): | |
response('200 OK', [('Content-Type', 'text/html')]) | |
yield '<ul>' |
""" | |
Works with SOUTH, and output on the same widget an HTML list with the value of the field | |
class MyModel(models.Model): | |
data = JSONField() | |
You will need simplejson installed with pip, Django 1.3+ | |
""" | |
from django.db.models.fields import Field |
import sys | |
import time | |
import gobject | |
import dbus, dbus.service | |
from dbus.mainloop.glib import DBusGMainLoop | |
dbus_loop = DBusGMainLoop() | |
dbus.set_default_main_loop(dbus_loop) | |
loop = gobject.MainLoop() |