Steps with explanations to set up a server using:
- virtualenv
- Django
- nginx
- uwsgi
| Esta son aplicaciones de django muy utiles, para como dice la filosofia de Instagram no reinventar la rueda :). | |
| django-mingus | |
| django-ratings | |
| django-ajax-validation | |
| django-google-analytics |
| # Create sudo user | |
| adduser <user> | |
| usermod -a -G sudo <user> | |
| logout | |
| # Update and clean | |
| sudo apt-get update | |
| sudo apt-get upgrade | |
| sudo apt-get dist-upgrade | |
| sudo apt-get autoremove |
| #!/usr/bin/env python | |
| """ | |
| MSN ApplicationId patcher for pidgin/bitlbee/whatever | |
| (because you're too lazy to rebuild the whole thing.) | |
| Usage examples: | |
| python patch.py /usr/sbin/bitlbee | |
| python patch.py /usr/lib/purple-2/libmsn.so |
| [user] | |
| name = Pavan Kumar Sunkara | |
| email = pavan.sss1991@gmail.com | |
| [core] | |
| editor = vim | |
| whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol | |
| excludesfile = ~/.gitignore | |
| [sendemail] | |
| smtpencryption = tls | |
| smtpserver = smtp.gmail.com |
| """ | |
| Two things are wrong with Django's default `SECRET_KEY` system: | |
| 1. It is not random but pseudo-random | |
| 2. It saves and displays the SECRET_KEY in `settings.py` | |
| This snippet | |
| 1. uses `SystemRandom()` instead to generate a random key | |
| 2. saves a local `secret.txt` |
| # -*- encoding: utf-8 -*- | |
| ###################################################################################################### | |
| ## ## | |
| ## SCRIPT EN PYTHON PARA EL RESPALDO DE BASES DE DATOS POSTGRES ## | |
| ## ## | |
| ## Almacenará tres tipos de copia: ## | |
| ## - Diarias: el sistema realizará una copia diaria por base de datos y eliminará aquellas ## | |
| ## que tengan más de N_DAYS_AGO_DIARY_BACKUP días de antiguedad ## | |
| ## - Semanales: el sistema realizará una copia semanal cada viernes de cada base de datos y ## |
| from vendas_project.vendas.models import Sale, SaleDetail | |
| s = Sale.objects.filter(pk=1) # filtra a Venda pelo pk | |
| d = SaleDetail.objects.filter(sale=s) # filtra os itens dessa Venda | |
| s = Sale.objects.get(pk=s) # com o get pega o pk da Venda que foi filtrada | |
| s.pk = None | |
| s.save() # salva uma cópia da Venda | |
| for i in d: | |
| n = SaleDetail.objects.create( | |
| sale=s, product=i.product, quantity=i.quantity, price_sale=i.price_sale, subtotal=i.quantity * i.price_sale) |
The IPython Notebook has two different keyboard input modes. Edit mode allows you to type code/text into a cell and is indicated by a green cell border. Command mode binds the keyboard to notebook level actions and is indicated by a grey cell border.
| <div class="slider__warpper"> | |
| <div class="flex__container flex--pikachu flex--active" data-slide="1"> | |
| <div class="flex__item flex__item--left"> | |
| <div class="flex__content"> | |
| <p class="text--sub">Pokemon Gen I</p> | |
| <h1 class="text--big">Pikachu</h1> | |
| <p class="text--normal">Pikachu is an Electric-type Pokémon introduced in Generation I. Pikachu are small, chubby, and incredibly cute mouse-like Pokémon. They are almost completely covered by yellow fur.</p> | |
| </div> | |
| <p class="text__background">Pikachu</p> | |
| </div> |