0
votes
65
views
E11000 duplicate key error index in mongodb
posted at July 12, 2018, 10:13 p.m. - 1 year, 7 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
67
views
Custom redirect urls django
posted at July 12, 2018, 10:13 p.m. - 1 year, 7 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
75
views
Remove all files .pyc with recrusive method
posted at July 12, 2018, 10:13 p.m. - 1 year, 7 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
76
views
Django Blog Python Learning released v.3.6 with feature autobackup
posted at July 12, 2018, 10:13 p.m. - 1 year, 7 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
82
views
Create Command Line interfaces with Python
posted at July 12, 2018, 10:13 p.m. - 1 year, 7 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
73
views
Django: Redirect HTTP to HTTPS
posted at July 12, 2018, 10:13 p.m. - 1 year, 7 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
69
views
Understanding Google reCAPTCHA in Django
posted at July 12, 2018, 10:13 p.m. - 1 year, 7 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
71
views
Djipsum: Plugin to generate the lorem ipsum (fake content) for django model
posted at July 12, 2018, 10:13 p.m. - 1 year, 7 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
95
views
How to implement the ForeignKey for multi databases Django
posted at July 12, 2018, 10:13 p.m. - 1 year, 7 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 …

0
votes
81
views
Step by step how to use multiple databases with database routers in Django
posted at July 12, 2018, 10:13 p.m. - 1 year, 7 months ago

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, …