This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command
$ docker-compose up -d
# To Tear Down
$ docker-compose down --volumes
""" | |
Django ORM Optimization Tips | |
Caveats: | |
* Only use optimizations that obfuscate the code if you need to. | |
* Not all of these tips are hard and fast rules. | |
* Use your judgement to determine what improvements are appropriate for your code. | |
""" | |
# --------------------------------------------------------------------------- |
We need to create a virtual env for our app to run in: More Here Run this command in whatever folder you want to create your venv folder
python -m venv ./venv
<!-- Instructions: | |
- Download and unzip Mojave dynamic background here: https://files.rb.gd/mojave_dynamic.zip | |
- Rename the extracted folder as "mojave-background" (Excuse the trouble but I renamed it on my machine and already use that path in the XML file) | |
- Save this xml file next to the Mojave background files | |
- Fix the path to the background images below (better using absolute path) | |
- Lastly, either: | |
+ GNOME: Use gnome-tweaks tool to select this XML as wallpaper (as default wallpaper settings won't let you choose wallpaper from custom path) | |
+ MATE: Go to background setting (in Appearance) > Choose +Add... > make sure **All files** filter is selected at the bottom right > Then choose mojave.xml | |
--> | |
<background> |
# https://gist.github.com/althonos/6914b896789d3f2078d1e6237642c35c | |
[metadata] | |
name = {name} | |
version = file: {name}/_version.txt | |
author = Martin Larralde | |
author_email = martin.larralde@embl.de | |
url = https://github.com/althonos/{name} | |
description = {description} | |
long_description = file: README.md |
import unicodecsv | |
from django.http import HttpResponse | |
def export_as_csv_action(description="Export selected objects as CSV file", | |
fields=None, exclude=None, header=True): | |
""" | |
This function returns an export csv action | |
'fields' and 'exclude' work like in django ModelForm | |
'header' is whether or not to output the column names as the first row | |
""" |
After updating pg_hba.conf or postgresql.conf, the server needs the config needs to be reloaded. The easiest way to do this is by restarting the postgres service:
service postgresql restart
When the service
command is not available (no upstart on Synology NAS, for example), there are some more creative ways to reload the config. Note this first one needs to be done under the user that runs postgres (usually the user=postgres
).
user# sudo su postgres
postgres# pg_ctl reload
# -*- coding: utf-8 -*- | |
from __future__ import absolute_import, unicode_literals | |
from rest_framework import serializers | |
from .models import User | |
class UserSerializer(serializers.ModelSerializer): | |
""" | |
User accounts serializer |
<!-- Example #1 - no styling --> | |
Made with ❤ in Switzerland | |
Made with ♥ in Switzerland | |
Made with ♡ in Switzerland | |
Made with ❤️ in Switzerland | |
Made with ♥️ in Switzerland | |
<!-- Example #2 - inline-styled ❤ --> | |
Made with <span style="color: #e25555;">♥</span> in Switzerland | |
Made with <span style="color: #e25555;">♥</span> in Switzerland |