- Update HISTORY.rst
- Update version number in
my_project/__init__.py - Update version number in
setup.py - Install the package again for local development, but with the new version number:
python setup.py develop
- Run the tests:
python setup.py test
| # coding: utf-8 | |
| from rest_framework import viewsets | |
| from rest_framework.response import Response | |
| from rest_framework.authentication import TokenAuthentication, SessionAuthentication | |
| from rest_framework.permissions import AllowAny, IsAuthenticated | |
| import models | |
| from rest_framework.decorators import detail_route, list_route, api_view, authentication_classes | |
| import serializers | |
| from django.core.signals import request_finished, request_started | |
| import time |
| # coding: utf-8 | |
| class Formater: | |
| cor = { | |
| 'ROXO' : '\033[95m', | |
| 'AZUL' : '\033[94m', | |
| 'VERDE' : '\033[92m', | |
| 'AMARELO' : '\033[93m', | |
| 'VERMELHO' : '\033[91m', |
my_project/__init__.pysetup.pypython setup.py develop
python setup.py test
| with open(args.project_name + r'/settings.py', 'wt') as fout: | |
| with open(resource_filename('robot_rest', 'settings.tpl'), 'rt') as fin: | |
| for line in fin: | |
| if '@projeto@' in line: | |
| fout.write(line.replace('@projeto@', args.project_name)) | |
| elif '@HOST@' in line: | |
| fout.write(line.replace('@HOST@', args.database_host)) | |
| elif '@USER@' in line: | |
| fout.write(line.replace('@USER@', args.database_user)) | |
| elif '@PASSWORD@' in line: |
| #!/usr/bin/env python | |
| import sys, os, time, atexit | |
| from signal import SIGTERM | |
| import logging | |
| import logging.handlers | |
| my_logger = logging.getLogger('LoyfyLogger') | |
| my_logger.setLevel(logging.CRITICAL) |
| from pymongo import MongoClient | |
| client = MongoClient() | |
| db = client.sbhistory | |
| cursor = db.room.find() | |
| for document in cursor: | |
| document['payload']['details']['users_name'] = [{"username": i, "seen": None, "received": None} for i in document['payload']['details']['users_name']] | |
| db.room2.insert(document) |
| """ | |
| Example of setting up CORS with Bottle.py. | |
| """ | |
| from bottle import Bottle, request, response, run | |
| app = Bottle() | |
| @app.hook('after_request') | |
| def enable_cors(): | |
| """ |
| [].forEach.call($$("*"),function(a){ | |
| var color = (~~(Math.random()*(1<<24))).toString(16) | |
| a.style.outline="1px solid #"+color; | |
| var dom = document.createElement("div"); | |
| dom.setAttribute("style", "font-size: 10px; margin:5px; background: #"+color); | |
| dom.innerText = a.localName; | |
| a.appendChild(dom); | |
| }) |