https://docs.djangoproject.com/es/1.9/topics/i18n/timezones/#troubleshooting
import datetime
from django.utils import timezone
# Return datetime now with UTC
naive = datetime.datetime.utcnow()
# Return datetime now with timezone| xclip -sel clip < ~/.ssh/id_rsa.pub |
| import random | |
| from datetime import datetime, timedelta | |
| min_year=1900 | |
| max_year=datetime.now().year | |
| start = datetime(min_year, 1, 1, 00, 00, 00) | |
| years = max_year - min_year+1 | |
| end = start + timedelta(days=365 * years) |
https://docs.djangoproject.com/es/1.9/topics/i18n/timezones/#troubleshooting
import datetime
from django.utils import timezone
# Return datetime now with UTC
naive = datetime.datetime.utcnow()
# Return datetime now with timezoneHow to generate graphic model Django with PyGraphViz?
sudo apt-get install -y graphviz libgraphviz-dev pkg-config
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install pygraphviz
pip uninstall pyparsing
pip install -Iv https://pypi.python.org/packages/source/p/pyparsing/pyparsing-1.5.7.tar.gz#md5=9be0fcdcc595199c646ab317c1d9a709| from django.forms import ModelForm | |
| from django.forms.models import inlineformset_factory | |
| from models import Sponsor, Sponsorship | |
| class SponsorForm(ModelForm): | |
| class Meta: | |
| model = Sponsor |
| # Shell script to create a complete Django project. | |
| # This script require Python 3.x and pyenv | |
| # Settings.py is config to Django 2.2.12 | |
| # The project contains: | |
| # Settings config | |
| # Person model and form | |
| # Person list and detail | |
| # Person create, update and delete | |
| # Admin config |
| # Shell script to create a project to Django-CMS with Python 3.5 | |
| # Download: | |
| # curl https://gist.githubusercontent.com/rg3915/15b2100f3eeba362ebd8/raw/27d1f1374f03e89bfc26648f08c35bc86eebc978/djangocms.sh -o djangocms.sh | |
| # Usage: | |
| # Type the following command, you can change the project name. | |
| # source djangocms.sh |
| urls = [ | |
| "/foo/", | |
| "/foo/bar", | |
| "/foo/bar/baz", | |
| "/foo/bar/bez", | |
| "/foo/bar/biz", | |
| "/foo/ber", | |
| "/foo/ber/baz", | |
| "/foo/ber/bez", | |
| "/foo/ber/biz", |
| from collections import defaultdict | |
| import copy | |
| import csv | |
| import json | |
| from urllib.parse import urlparse | |
| def parser_urls(urls, orig={}): | |
| ''' | |
| recebe uma lista de urls e vai parseando enquanto essa tiver um diretorio |
| #!/usr/bin/env bash | |
| # Install dependencies | |
| yum update -y | |
| yum install -y gcc apr-devel apr-util-devel openssl-devel pcre-devel libxml2-devel libcurl-devel | |
| mkdir setup && cd setup | |
| wget wget https://olex-secure.openlogic.com/content/private/5e6a6f0815e830bba705e79e4a0470fbee8a5880//olex-secure.openlogic.com/httpd-2.4.16.tar.gz | |
| tar -xvf httpd-2.4.16.tar.gz |