Eliminar los archivos de migraciones:
find . -not -path "./.venv/*" -path "*/migrations/*.py" ! -name "__init__.py" -delete
Volver a generar las migraciones:
python manage.py makemigrations
Eliminar los archivos de migraciones:
find . -not -path "./.venv/*" -path "*/migrations/*.py" ! -name "__init__.py" -delete
Volver a generar las migraciones:
python manage.py makemigrations
from selenium.webdriver import Chrome | |
from selenium.webdriver.chrome.options import Options | |
options = Options() | |
options.binary_location = '/opt/headless-chromium' | |
options.add_argument('--headless') | |
options.add_argument('--no-sandbox') | |
options.add_argument('--start-maximized') | |
options.add_argument('--start-fullscreen') |
<div style="margin:0px;padding: 0px;"> | |
<p style="padding:0px;font-size: 13px;"> | |
Estimado/a | |
% if object.partner_id.parent_id: | |
${object.partner_id.name} (${object.partner_id.parent_id.name}) | |
% endif | |
<br><br> | |
Junto con saludarle y agradecer su preferencia, adjuntamos | |
% if object.name: | |
factura <strong>${object.name}</strong> |
[options] | |
# | |
# WARNING: | |
# If you use the Odoo Database utility to change the master password be aware | |
# that the formatting of this file WILL be LOST! A copy of this file named | |
# /etc/odoo/openerp-server.conf.template has been made in case this happens | |
# Note that the copy does not have any first boot changes | |
#----------------------------------------------------------------------------- | |
# Odoo Server Config File - TurnKey Linux |
# project-repo/app/settings/.env-example | |
# | |
# DJANGO | |
# | |
SITE_HOST=localhost:8000 | |
USE_SSL=False | |
ALLOWED_HOSTS=localhost,127.0.0.1 | |
SECRET_KEY=asdasd | |
DEBUG=true # never on production, will cause settings including api keys to leak | |
DJANGO_LOG_LEVEL=DEBUG |
from django import forms | |
from django.core import validators | |
from django.core.exceptions import ValidationError | |
class MinLengthValidator(validators.MinLengthValidator): | |
message = 'Ensure this value has at least %(limit_value)d elements (it has %(show_value)d).' | |
class MaxLengthValidator(validators.MaxLengthValidator): | |
message = 'Ensure this value has at most %(limit_value)d elements (it has %(show_value)d).' |
# admin.py: admin action definition | |
def make_copy(self, request, queryset): | |
form = None | |
if 'apply' in request.POST: | |
form = CopyPageForm(request.POST) | |
if form.is_valid(): | |
issue = form.cleaned_data['issue'] |
apt-get install python-pygraphviz | |
pip install django-extensions | |
# add 'django_extensions' to INSTALLED_APPS in settings.py | |
python manage.py graph_models trees -o test.png |
There are two main modes to run the Let's Encrypt client (called Certbot
):
Webroot is better because it doesn't need to replace Nginx (to bind to port 80).
In the following, we're setting up mydomain.com
.
HTML is served from /var/www/mydomain
, and challenges are served from /var/www/letsencrypt
.
import xlsxwriter | |
from io import BytesIO | |
from django.http import StreamingHttpResponse | |
from django.views.generic import View | |
def get_foo_table_data(): | |
""" | |
Some table data | |
""" |