This is an unofficial manual for the couchdb
Python module I wish I had had.
pip install couchdb
//Genera un número aleatorio entre un rango de enteros | |
function patito(minimo, maximo) | |
{ | |
var numero = Math.floor( Math.random() * (maximo - minimo + 1) + minimo ); | |
return numero; | |
} | |
var opciones = ["Piedra", "Papel", "Tijera","Lagarto", "Spock"]; | |
var opcionUsuario; |
//http://stackoverflow.com/questions/15877362/declare-and-initialize-a-dictionary-in-typescript | |
interface IDictionary { | |
add(key: string, value: any): void; | |
remove(key: string): void; | |
containsKey(key: string): bool; | |
keys(): string[]; | |
values(): any[]; | |
} |
def file_to_base64(file_path): | |
""" | |
A simple function which accepts the file_path and | |
converts and returns base64 string if specified file | |
exists. Returns blank string '' if file is not found. | |
""" | |
from os import path | |
if not path.exists(file_path): | |
return '' | |
return open(file_path, 'rb').read().encode('base64') |
{% with messages = get_flashed_messages(with_categories=true) %} | |
<!-- Categories: success (green), info (blue), warning (yellow), danger (red) --> | |
{% if messages %} | |
{% for category, message in messages %} | |
<div class="alert alert-{{ category }} alert-dismissible" role="alert"> | |
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> | |
<!-- <strong>Title</strong> --> {{ message }} | |
</div> | |
{% endfor %} | |
{% endif %} |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
#INSTALL FLASK WITH: pip install Flask | |
from flask import Flask, request | |
app = Flask(__name__) | |
@app.route('/saludo', methods=['GET']) | |
def hello(): |
This is an unofficial manual for the couchdb
Python module I wish I had had.
pip install couchdb
[packages] | |
flask = "*" | |
flask-sqlalchemy = "*" | |
"psycopg2" = "*" | |
gunicorn = "*" | |
[requires] |
For the lesson today, we are going to deploy our application to a live server.
The current workspace provided by cloud9 is meant only for development and not for production. By that, we mean you can use the service to write and even test your code but not to run your service.
For this we will be using a platform called heroku. Heroku is a PAAS (Platform As A Service).
This means you will not need to work VMs and such. Heroku will work with your code as long as you push it, which do using a similar technique.
The main things to consider when hosting your code will be:
write(vals) | |
Updates all records in the current set with the provided values. | |
:param dict vals: fields to update and the value to set on them e.g:: | |
{'foo': 1, 'bar': "Qux"} | |
will set the field ``foo`` to ``1`` and the field ``bar`` to | |
``"Qux"`` if those are valid (otherwise it will trigger an error). | |
:raise AccessError: * if user has no write rights on the requested object | |
* if user tries to bypass access rules for write on the requested object | |
:raise ValidateError: if user tries to enter invalid value for a field that is not in selection | |
:raise UserError: if a loop would be created in a hierarchy of objects a result of the operation (such as setting an object as its own parent) |
Copyright (C) 2018 Robert Rottermann redO2oo.ch
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,