For local project settings, I use old trick with
try: from settings_local import * except ImportError: pass
settings_local.py we can override variables from
settings.py. I didn't know how to supplement them. For example how to add line to
INSTALLED_APPSwithout copying whole list.
Yesterday I finally understood that I can import
# settings_local.py from settings import * INSTALLED_APPS += ( # ... )
Now, couple years later I prefer having separate settings file for different environments, as it is described in 2 scoops of django.
In this article I will describe how to integrate geolocation HTML5 function to a web app so you can then easily implement it in your apps or websites. As an example we are going to create small web app which will be able to calculate the shortest route between detected user’s location and predefined destination using Google Maps API.
There was a task to submit form with ajax, with server side validation of course. Obvious solution is to do validation and return json with erros. I didn't like idea of writing separate view for validation and then inserting errors in form html on client side. Especially since I already had a generic template for django form with errors display. In this article I'll describe how I solved the task.