ytyng.com

Latest Articles

Page 11
Django
2018-09-27 02:37 (7 years ago)
Preventing "table already exists" error when canceling migrations in Django tests

Avoid `table already exists` failures in Django tests when running with `--keepdb` after cancelling migrations — how to forcibly reset the test DB migration state.

Django
2018-09-25 10:10 (7 years ago)
Unit Testing Abstract Models in Django

Django: Best way to unit-test an abstract model - Stack Overflowhttps://stackoverflow.com/questions/4281670/django-best-way-to-unit-test-an-abstract-model

2018-09-21 03:37 (7 years ago)
Replacing Version Numbers with Python re (Regex Replacement Only Within Parentheses)

Use a lambda callback with Python's `re.sub` to replace only a captured group (e.g. a version number) inside a larger pattern.

2018-09-19 06:33 (7 years ago)
Apache2 URL without .html returns the content of the html file

MultiViews is enabled

2018-09-04 01:53 (7 years ago)
When Starting AD Domain Controller (samba-ad-dc) on Ubuntu 18 with Samba 4.7, It Fails Due to DNS Errors

When you start samba-ad-dc using the command `$ sudo systemctl start samba-ad-dc`, and check either /var/log/samba/log.smbd or /var/log/samba/%m, it appears that port 53 is unavailable.

2018-09-03 11:11 (7 years ago)
When Apache on Ubuntu 18.04 is Forcefully Terminated

Apache suddenly crashes, and upon checking the logs, I found the following messages: "AH00050: Child 7815 returned a Fatal error... Apache is exiting!" and "AH02818: MPM run failed, exiting."

2018-09-03 08:36 (7 years ago)
What to Do If Your Update to Ubuntu 18.04 Gets Stuck

When `do-release-upgrade` to Ubuntu 18.04 hangs on libnih1 or upstart packages, here is how to unstick and complete the release upgrade.

2018-08-16 06:07 (7 years ago)
Notes on Installing chromedriver

Strip 4-byte characters (emoji, some kanji) from a Python 3 `requests` response — useful when storing into MySQL utf8 (3-byte) columns.

2018-08-14 06:45 (8 years ago)
When python3.6 -m venv Errors Occur on Ubuntu

If `python3.6 -m venv venv` fails on Ubuntu, the `python3.6-venv` package is missing — install it via apt to enable virtual environment creation.

Django
2018-07-12 11:24 (8 years ago)
Issues with Redirect URLs Being HTTP Instead of HTTPS in Python Social Auth Django or AllAuth

One-liner to count upgradable packages with `apt list --upgradable`, plus a shell script to surface the number in the MOTD login banner.

2018-07-11 02:42 (8 years ago)
When a Volume Mounted with Goofys is Not Visible to Other Users

If the volume mounted with Goofys is not visible to other users

Python
2018-07-04 06:08 (8 years ago)
Reading BOM-Included TSV Files with Python

When you download a CSV from Amazon, it might sometimes be a TSV with a BOM.

2018-06-29 12:58 (8 years ago)
Setting Up Site-to-Site VPN with OpenVPN

Notes on installing OpenVPN on an Ubuntu server and setting up a site-to-site VPN.

Python
2018-06-21 02:34 (8 years ago)
Add SSL CA Certificate to Ubuntu and Use It with Python Requests

1. If the certificate is in DER format, convert it to PEM

Django
2018-05-15 03:24 (8 years ago)
Creating a ForeignKey Across Databases in Django 2.0

※ This does not mean creating constraints in an RDB. It simply means creating a ForeignKey field that works for now.

2018-05-11 02:30 (8 years ago)
What to Do When You Can't Update PIP for Python 2.7 in the Default Mac Environment

sudo bash -c "curl -kL https://bootstrap.pypa.io/get-pip.py | python"

2018-05-02 08:16 (8 years ago)
Create a Shared Folder in Windows 10 Accessible Without Login (Authentication)

How to Create a Shared Folder That Can Be Accessed by Anyone Without Authentication.

Django
2018-03-29 06:37 (8 years ago)
NameError: name 'module1' is not defined when running ./manage.py test in Django

Make Django's `request.build_absolute_uri()` return HTTPS behind Apache + ELB — `USE_X_FORWARDED_HOST` and `SECURE_PROXY_SSL_HEADER` settings.

2018-03-07 13:13 (8 years ago)
Please provide valid credentials with Yahoo Store API

<Error><Message>Please provide valid credentials. Bearer realm="yahooapis.jp", error="insufficient_scope", error_description="insufficient scope"</Message></Error> I encountered the above error when using Yahoo's Store API.

Ansible
2018-02-27 01:27 (8 years ago)
Ansible Playbook for Installing Docker CE on Ubuntu 16.04

A complete Ansible playbook to install Docker CE on Ubuntu 16.04 — apt key, repository registration, and the docker-ce package install in one playbook.