0
votes
79
views
How to minify HTML output in Django
posted at July 12, 2018, 10:13 p.m. - 1 year, 2 months ago

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 …

0
votes
79
views
E11000 duplicate key error index in mongodb
posted at July 12, 2018, 10:13 p.m. - 1 year, 2 months ago

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 …

0
votes
73
views
Custom redirect urls django
posted at July 12, 2018, 10:13 p.m. - 1 year, 2 months ago

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 …

0
votes
77
views
Remove all files .pyc with recrusive method
posted at July 12, 2018, 10:13 p.m. - 1 year, 2 months ago

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 …

0
votes
79
views
Django Blog Python Learning released v.3.6 with feature autobackup
posted at July 12, 2018, 10:13 p.m. - 1 year, 2 months ago

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 …

python django project news
0
votes
87
views
Create Command Line interfaces with Python
posted at July 12, 2018, 10:13 p.m. - 1 year, 2 months ago

Building command line programs has been a long time passion of mine. There’s something magical about making a simple, intuitive, and composable CLI. There’s also nothing more beautiful than chaining …

linux python
0
votes
72
views
Django: Redirect HTTP to HTTPS
posted at July 12, 2018, 10:13 p.m. - 1 year, 2 months ago

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 …

0
votes
78
views
Understanding Google reCAPTCHA in Django
posted at July 12, 2018, 10:13 p.m. - 1 year, 2 months ago

Understanding Google reCAPTCHA in Django. I found this awesome answer to simply understand how to use API from Google reCAPTCHA. import urllib, urllib2 def recaptcha(request, postdata): rc_challenge = postdata.get('recaptcha_challenge_field', '') …

python django api security
0
votes
76
views
Djipsum: Plugin to generate the lorem ipsum (fake content) for django model
posted at July 12, 2018, 10:13 p.m. - 1 year, 2 months ago

Djipsum Plugin to generate the lorem ipsum (fake content) for django model. Sometimes, I feel bored when i want to create many contents such as fake content in once time. …

django python project
0
votes
102
views
How to implement the ForeignKey for multi databases Django
posted at July 12, 2018, 10:13 p.m. - 1 year, 2 months ago

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 …