Quick to understanding git step by step

By: summonagus ● at Oct. 6, 2016, 6:56 a.m. ● Posted under: #Tricks, #Beginner

Quick to understand git step by step. Git is a version control system that is used for software development and other version control tasks. As a distributed revision control system it is aimed at speed, data integrity, and support for distributed, non-linear workflows. Git was created by Linus Torvalds in ...

Read More →

Django Blog Python Learning released v.3.6 with feature autobackup

By: summonagus ● at Oct. 4, 2016, 9:28 a.m. ● Posted under: #Problem, #Database, #APP, #Django, #News, #Project

Previously, the Django already has a method to backup the database to the json file with quick command: $ ./manage.py dumpdata --format=json > outfile.json Yup, with dumpdata. But why this "Django Blog Python Learning" not use it? We need to explore and use another method, so we know what we ...

Read More →

How to make cronjob for Django in Hosting, VPS or Server

By: summonagus ● at Oct. 2, 2016, 5:23 p.m. ● Posted under: #Tricks, #Database, #Django, #Project, #Solution

How to make cronjob for Django in Hosing, VPS or Server. This config also what we do in this site. For example, in your file of /yourproject/yourapp/management/commands/autobackup.py from django.core.management.base import BaseCommand, CommandError class Command(BaseCommand): help = 'To backup your app!' def add_arguments(self, parser): parser.add_argument( 'backup', help='To backup your app!' ) ...

Read More →

Remove all files .pyc with recrusive method

By: summonagus ● at Oct. 2, 2016, 5:15 p.m. ● Posted under: #Tricks, #Solution

Remove all files .pyc with recrusive method - This method simple but important. Example in your project dir is like this: project_dir/ __init__.py __init__.pyc something.py something.pyc ... core/ __init__.py __init__.pyc build.py build.pyc Deleting the .pyc files one by one would be spending a lot of time. and you will be ...

Read More →

Change backend gmail to Postmarkapp for Django

By: summonagus ● at Oct. 2, 2016, 5:11 p.m. ● Posted under: #Settings, #Module, #Django, #News, #Project, #API, #Solution

1. Install module of Python Postmark Install this module manually from souce inside your environtment: https://github.com/themartorana/python-postmark If you work on Django==1.9.*, requirements only mock.2. Register and Put the Server KeysRegister and put your server API token here: https://account.postmarkapp.com/servers/101010/credentials . 101010 is id of your server.Makesure verified your SPF and DKIM. ...

Read More →

Custom redirect urls django

By: summonagus ● at Oct. 2, 2016, 5:06 p.m. ● Posted under: #Tricks, #Django

Example in this problem we need redirect the url http://localhost:8000/a/b/C/123/4/5/ to http://localhost:8000/abC12345 without / slash. 1. In your views.py from django.http import HttpResponse from django.views.generic.base import RedirectView from django.core.urlresolvers import reverse class UserRedirectView(RedirectView): # Ref: http://stackoverflow.com/a/16627830/3445802 permanent = False def get_redirect_url(self, pk): pk = ''.join(str(pk).split('/')) return reverse('pool_fix_page', kwargs={'pk': pk}) def ...

Read More →

E11000 duplicate key error index in mongodb

By: summonagus ● at Oct. 2, 2016, 4:55 p.m. ● Posted under: #Problem, #Database, #Flask, #Solution

E11000 duplicate key error index in mongodb. I found this error after migrating my field from "unique" to "non-unique". And in this problem we use mongoengine for flask. First, i have a model such as bellow class Tag(db.Document): title = db.StringField(max_length=50, unique=True) and then, i need to change it without ...

Read More →

How to minify HTML output in Django

By: summonagus ● at Oct. 2, 2016, 4:40 p.m. ● Posted under: #Tricks, #Templates, #Django

So, you want to compress the size of the HTML that Django generates? Here is the Django way to do it. In order to do this, you'll have to write a middleware for your application. So, create a file called middleware.py (for this example, but you can name it whatever ...

Read More →

Free SMS Sender using smsmasking

By: summonagus ● at Oct. 2, 2016, 4:19 p.m. ● Posted under: #Tricks

Free SMS Sender using smsmasking - API Documentation of smsmasking only available for PHP and JavaScript using POST method, in this post i wanna share simply how to use API smsmasking for Python.import sys import json import requests URL_API = 'http://smsmasking.ca/api.html' def sendSMS(sender, number, message): message_data = { 'sender' : ...

Read More →

Simple bash scripting for login before open the terminal

By: summonagus ● at Oct. 2, 2016, 3:52 p.m. ● Posted under: #Tricks, #Security

Add this in your file of /etc/bash.bashrc, makesure you logged in as root. while true; do # Don't exit at Ctrl-C trap "echo" SIGINT printf "\n" echo -n " Who are you guys? "; read -s name; if [ "$name" == "agus" ]; then reset printf "\n Welcome my KING! ...

Read More →