All Posts Create a Post
Django Standard API Response Middleware for DRF
As you can see, if you using django-rest-framework, you will found many different response format. This middleware to solve all of these problems with implement the Standard API Response. All …
Step by step how to use multiple databases with database routers in Django
1. Please create a new superuser for the second/default/current database. Because you will getting this issue that i already asked before: https://gitter.im/django/django?at=5810b0b5806316005dc11f46 i use multiple site, multiple env, multiple project, …
E11000 duplicate key error index in mongodb
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 …
Simply how to fix .rst (reStructuredText) for PyPi
Hello guys, this night i want to share simply tutorial how to fix .rst (reStructuredText) format for PyPi. This problem simple but important. previously, i was confused to handle this …
Django: Redirect HTTP to HTTPS
Django: Redirect HTTP to HTTPS, basically the Django already support to handle this redirection at https://docs.djangoproject.com/en/dev/topics/security/#ssl-https Edit in your settings.py # Redirecting from `HTTP` to `HTTPS` for Django 1.8 or …
Custom redirect urls 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 …
How to implement the ForeignKey for multi databases Django
Previously i had confused how to handle this problem, this problem also already asked by someone on stackoverflow (Cross Database foreign key error) and has the best answered by someone …
How to minify HTML output in 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 …
Remove all files .pyc with recrusive method
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 …
Djipsum already in new version 1.0.9
Djipsum already in new version 1.0.9. Djipsum is awesome command plugin to generate fake content for Django. What news? Fixed ManyToManyField (return the random objects from many to many field). …