Dump existing data:
python3 manage.py dumpdata > datadump.json
Change settings.py to Postgres backend.
Make sure you can connect on PostgreSQL. Then:
| import logging | |
| from colorama import init, Fore, Back | |
| init(autoreset=True) | |
| class ColorFormatter(logging.Formatter): | |
| # Change this dictionary to suit your coloring needs! | |
| COLORS = { | |
| "WARNING": Fore.RED, |
| #!/bin/bash | |
| # Script to use custom ssh keys for various git repositories | |
| # Run without arguments to get usage info. | |
| # | |
| # How it works: | |
| # When used with SSH, git sends the path to the repository in the SSH command. | |
| # @see: https://github.com/git/git/blob/e870325/connect.c#L1268 | |
| # We extract this info and search for a key with the name. | |
| # Based on the source, this seems to be used format since v2.0 at least. | |
| # @see: https://github.com/git/git/commit/a2036d7 |
| from websocket import create_connection | |
| import json | |
| # Copy the web brower header and input as a dictionary | |
| headers = json.dumps({ | |
| 'Accept-Encoding': 'gzip, deflate, br', | |
| 'Accept-Language': 'en-GB,en-US;q=0.9,en;q=0.8', | |
| 'Cache-Control': 'no-cache', | |
| 'Connection': 'Upgrade', | |
| 'Host': 'streamer.cryptocompare.com', |
Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
| import xml.etree.ElementTree as ET | |
| import requests | |
| url = "https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx?WSDL" | |
| headers = {"content-type": "text/xml"} | |
| # Change this | |
| tc_no = "XXXXXXXXXXXX" | |
| ad = "NAME" | |
| soyad = "SURNAME" |
| var mediaJSON = { "categories" : [ { "name" : "Movies", | |
| "videos" : [ | |
| { "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org", | |
| "sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ], | |
| "subtitle" : "By Blender Foundation", | |
| "thumb" : "images/BigBuckBunny.jpg", | |
| "title" : "Big Buck Bunny" | |
| }, | |
| { "description" : "The first Blender Open Movie from 2006", | |
| "sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ], |
The philosophy behind Documentation-Driven Development is a simple: from the perspective of a user, if a feature is not documented, then it doesn't exist, and if a feature is documented incorrectly, then it's broken.