Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to call a django view function based on its namespace and fun name from js?
To call a Django view from HTML we use the following: "{% url 'namespace: view_fun' %}" But how to do this from Javascript? Thank you! -
Error redirecting to ?next page after logged in in Django
I'm trying to redirect user back to the current page with the following template: base.html {% if user.is_authenticated %} <li>User: {{ user.get_username }}</li> <li><a href="{% url 'logout' %}?next={{request.path}}">Logout</a></li> {% else %} <li><a href="{% url 'login' %}?next={{request.path}}">Login</a></li> {% endif %} When a user logout, they would be brought to the current page, which is expected. However, users are redirected to / when logged in, presumably because I've set LOGIN_REDIRECT_URL to '/' in the project's settings.py. If I unset LOGIN_REDIRECT_URL, they would be brought to /accounts/profile/, which is also not what I want. Error message: [23/Mar/2017 17:23:16] "GET /accounts/login/?next=/catalog/ HTTP/1.1" 200 1806 [23/Mar/2017 17:23:45] "POST /accounts/login/ HTTP/1.1" 302 0 [23/Mar/2017 17:23:45] "GET / HTTP/1.1" 301 0 [23/Mar/2017 17:23:45] "GET /catalog/ HTTP/1.1" 200 1707 It seems that the ?next argument in the URL is not working. Then how do I specify the link to which users are redirected after they've logged in? -
Aggregates in Django 1.11 and Postgres 9.6 causing invalid SQL
I have a Video and VideoLog model. Until now I've been happy enough annotating on a count to see how many times a video has been watched: Video.objects.annotate( views=Count('logs'), # logs is the related name from the VideoLog model ) This works fine on SQLite but we've just upgraded to Postgres 9.6 and trying to run that gives me ProgrammingError: column "video_video.name" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: SELECT "video_video"."id", "video_video"."name", "video_vide... Here's the formatted query it's running: SELECT "video_video"."id", "video_video"."name", "video_video"."shorttext", "video_video"."text", "video_video"."thumbnail", "video_video"."product_id", "video_video"."slug", "video_video"."available_sizes", "video_video"."preview_image", "video_video"."certificate", "video_video"."download", Count("video_videolog"."id") AS "views" FROM "video_video" LEFT OUTER JOIN "video_videolog" ON ( "video_video"."id" = "video_videolog"."video_id" ) GROUP BY "video_video"."id" What's going on? Is Django not compatible with Postgres 9.6 yet? -
celery systemd multiple services one delay not working
Help! I need the power of your collective consciousness! Here's the case. I'm trying to build an NGINX/Gunicorn/Celery/RabbitMQ/Django server for several services. Each is a Django application below NGINX/Gunicorn, that's the easy part. One service, let's call it 'harvester', has some celery @shared_task and a celerybeat @periodic_task that launches it. The other service, 'factory', has only one @shared_task. The point is - when celerybeat launches 'harvester.tasks.harvesting', it sends the result to an API method of the 'factory' service. This method validates data, and if correct, launches the 'factory' task... like factory_task.delay(record) And here goes the problem. While both daemons of the 'harvester' service work correct... the task of the 'factory' service is not launched at all. No records in the logs... no errors... all services run as usual... Versions: Ubuntu: 16.04 Python: 2.7.12 Django: 1.10.6 Celery: 4.0.2 Kombu: 4.0.2 RabbitMQ: 3.5.7 Here're config files: **1. HARVESTER ** 1.1 /etc/systemd/system/celery-harvester.service [Unit] Description=celery harvester daemon After=network.target [Service] Type=forking User=user Group=group EnvironmentFile=/var/www/harvester/config/celery.conf WorkingDirectory=/var/www/harvester/project # PIDFile=/var/www/harvester/socket/celery_harvester.pid PrivateTmp=true Restart=on-failure NoNewPrivileges=yes ExecStart=/bin/sh -c '${CELERY_BIN} multi start ${CELERYD_NODES} \ -A ${CELERY_APP} -Q ${CELERY_QUEUES} --pidfile=${CELERYD_PID_FILE} \ --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OP$ ExecStop=/bin/sh -c '${CELERY_BIN} multi stopwait ${CELERYD_NODES} \ --pidfile=${CELERYD_PID_FILE}' ExecReload=/bin/sh -c '${CELERY_BIN} multi restart ${CELERYD_NODES} \ -A ${CELERY_APP} -Q ${CELERY_QUEUES} … -
Why does my PostgreSQL Full Text Search not return my objects and how to fix it?
I can't get the PostgreSQL Full Text Search feature to work as I need it. I have a model Vereinwith a field straße. There are two Verein objects where straße has the value "Uhlandstraße". What I want to achieve is that a search for "Uhl", "uhl", "nds", "straße" or "andstr" (you get the idea) returns those objects. Instead it does this: >>> # With missing only 1 char at the end of the word, the search works. >>> Verein.objects.filter(straße__search='Uhlandstraß') <QuerySet [<Verein: 1>, <Verein: 2>]> >>> # With missing more than 1 char at the and of the word, the search does not work. >>> Verein.objects.filter(straße__search='Uhl') <QuerySet []> >>> Verein.objects.filter(straße__search='Uhlandstra') <QuerySet []> >>> # Same amount of chars as the working example, but from the end of the word, it does not work >>> Verein.objects.filter(straße__search='hlandstraße') <QuerySet []> Any ideas what I need to change to get it working like explained? -
Exception: render() missing 1 required positional argument: 'template_name'. Why am i getting this exception? haven't came across this before
def index(request): if request.method == 'POST': State_name = request.POST.get('statename', '') state = states(State_name=State_name) state.save() The exception is located in the render. render() missing 1 required positional argument: 'template_name' return render('report/states.html') -
django is authenticated false after calling login
Django user is not aithenticated in second view B if I call login in first view A : View A: login(user, request) print(user.is_authenticated()) # True View B: (called after View A) print(request.user.is_authenticated()) # False Settings.py REST_FRAMEWORK = { # Use Django's standard `django.contrib.auth` permissions, # or allow read-only access for unauthenticated users. 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework.authentication.BasicAuthentication', 'rest_framework.authentication.SessionAuthentication', ), 'DEFAULT_PERMISSION_CLASSES': ( 'rest_framework.permissions.IsAuthenticated', ) } MIDDLEWARE = [ 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] What makes authentication disapear in View B ? -
Django. Overide the html format of a FileField field in the change page via ModelAdmin
This is my sample code (and see the screenshot): models.py class User(models.Model): # the variable to take the inputs user_name = models.CharField(max_length=100) user_avatar = models.FileField(upload_to = 'images/%Y%m%d') admin.py class UserAdmin(admin.ModelAdmin): exclude = ('user_avatar',) readonly_fields = ('avatar_readonly',) def avatar_readonly(self, instance): value_link = "/mediafileupdown/download/" + str(instance.id) value_desc = str(instance.user_avatar.name) return format_html('<a href="{}">{}</a>', value_link, value_desc) avatar_readonly.short_description = "User avatar (read only)" avatar_readonly.allow_tags=True screenshot The problem is: i'd like obtain the 'Currently' user_avatar's link (that's a models.FileField field) via the my 'download' views and not as simple url. I can do that if the field is in the 'readonly_fields' list and so I can overide the html format ... in that case, on the change page, the 'avatar_readonly' link is redirected to the my 'download' view. The question is: how can I get the same result (overide the html format) in a FileField (like my 'user_avatar') when is not in the readonly_fileds list? Sorry for my english and many Thanks for the help. -
What data storage services should I use to deploy a video streaming website?
I'm currently working on a video streaming website in django which stores and streams videos like Youtube. Now, I want to take this website live, what cloud services should I use to store the videos? Preferably something free. From what all I've read, all I can find is AWS and MongoDB -
Django's Multiwidget don't join values
I have a problem, with never happened before, and is that my subclassed MultiWidget isn't join values for the cleaned_data of my Modelform, but data shows the values correctly. It is strange, as I didn't change anything on the code (also I don't have anything that modifies then). It wasn't suppossed that the data is joined automatically? What happened? Someone had this problem before? -
Restrict access in apache config to django staff users
I want to use django's user system to restrict access to locations on my apache server which are not served by django (specifically in my case a location which is a CalDAV endpoint). In particular I'd like to be able to specify that only django staff members can access them, but I can't see how to do that. My configuration at the moment looks like: <VirtualHost *:80> ServerName cal.myhost.net WSGIDaemonProcess cal.myhost.net python-path=... user=cal group=cal home=... WSGIProcessGroup cal.myhost.net WSGIScriptAlias / /usr/local/python/django-site/calendar_wsgi.py AuthType Basic AuthName "Calendar access" AuthBasicProvider wsgi WSGIAuthUserScript /usr/local/python/django-site/access_wsgi.py Require valid-user <Directory /usr/local/python/django-site> Require all granted AllowOverride None Order allow,deny Allow from all </Directory> </VirtualHost> access_wsgi.py is a pretty vanilla access WSGI file and looks like: import os os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' from django.contrib.auth.handlers.modwsgi import check_password I know I could work around this either by adding a django group to the users I want to allow access to and using WSGIAuthGroupScript, but I'd like to know if there is a way using the apache config to test for staff-status. -
Modelform Querysets with foreignKeys
I have a challenge on how to best I can produce my form when adding products into my database. model.py class Category(models.Model): title = models.CharField(max_length...) class Department(models.Model): categories = models.ForeignKey(Category) class ProductDivisions(models.Model): departments = models.ForeignKey(Department) class Product(models.Model): division = models.ForeignKey(ProductDivisions) title = models.CharField(max_length...) and my FORMS.py from .models import Category, Department, ProductDivisions class ProductForm(forms.Form): category = forms.ModelChoiceField(widget=forms.Select(), empty_label=None, queryset=Category.objects.all department = forms.ModelChoiceField(widget=forms.Select(), empty_label=None, queryset=Department.objects.all()) productDivisions = forms.ModelChoiceField(widget=forms.Select(), empty_label=None, queryset=ProductDivisions.objects.all()) def __init__(self,categories_id,*args,**kwargs): super (ProductForm,self ).__init__(*args,**kwargs) self.fields['department'].queryset = Department.objects.all() So when I select the categories are doing fine but the departments' dropdown is showing all the departments including those from a different Category and the same happens to the ProductDivisions' dropdown, showing all of them together including the ones from a different department. help me with a suggestion on how to make it proper so that I the Department dropdown only shows the ones from a specific category and also make the ProductDivisions dropdown to show the ones from a specific department, If the issue is with the DB, suggestions are welcome -
Unable to post data via HTTP POST in angular 2 on local development server
i am new to web development and trying to get my first app working using Angular 2. I have a reactive form from which i am building a sample invoice which has header and items information. When i try to post the data to store in DB hosted on another machine within the same network, i am getting some error on Observable operator Map stating "[Exception: TypeError: 'caller' and 'arguments' are restricted function properties and cannot be accessed in this context. at Function.remoteFunction (<anonymous>:2:14)]/ Here is the code : for simplicity, i have created a variable sampleInvoice with a preformatted JSON structure that is acceptable to the server. I have tried this data to be posted using REST extension for Chrome and it works fine. invoice.service.ts import { Injectable } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import { of } from 'rxjs/observable/of'; import 'rxjs/add/operator/delay'; import { Http, Headers, RequestOptions,Response, RequestMethod} from '@angular/http'; import { Invoice, invoices } from './invoice'; createInvoice(invoice: Invoice): Observable <Invoice>{ let sampleInvoice = { "invoiceDate":"2017-03-21", "mobileNumber": 8297088993, "salesPerson": "Ramesh", "paymentMode": "CASH", "numOfItems": 1, "grossAmount": "2100.00", "totalDiscount": "200.00", "totalTax":"100.00", "netAmount": "2000.00", "paidAmount": "2000.00", "items": [ { "lineItem": 1, "productBarcode": "product1", "quantity": 1, "itemGrossAmount":"1200.00", "itemDiscount": "50.00", "itemTax":"50.00", … -
Django prevent multiple submits
I am using Django 1.9 I am trying to create a protection of the user clicking multiple times on the submit button. What I did I create a unique token for the form; when you submit the form a decorator checks do you have session var with the same token. In theory should work in practise no. If I click 10 times will get around 5-6 new entries Here is the code My View: @form_token_check def new(request, **kwargs): if request.method == "POST" and kwargs['form_token']: ====write to DB===== My decorator: def form_token_check(func): def inner(request, *args, **kwargs): kwargs['form_token'] = False if request.method == "POST": new_form_token = request.POST.get('form-token', '') if 'form-token' in request.session: old_form_token = request.session['form-token'] if new_form_token != old_form_token: kwargs['form_token'] = True request.session['form-token'] = new_form_token else: kwargs['form_token'] = True request.session['mlvr-form-token'] = new_form_token return func(request, *args, **kwargs) return inner -
Django/Haystack/Elasticsearch show all results when no query is provided
this is my first post here, so if I did something I shouldn't say it and I will change it. I am currently developing a project with django. I got stuck several times but were able to help myself with the great questions and answers here at stackoverflow. I am now at a point where I can't help myself with that alone so here is the question: I am implementing search with haystack and elasticsearch. All indexing works and I get the results I want. Ordering and filtering works too. Now I want to be able to show all results by default and then filter or order them without a query. I already tried everything at Django Haystack - Show results without needing a search query? It doesn't seem to work for me though to subclass the Searchform. My Code: forms.py: class CustomSearchForm(SearchForm): def no_query_found(self): print('no query') return self.searchqueryset.all() search.html: <form method="get" action="."> {{ form.as_table }} <button>hit</button> </form> ... {% if query or page_obj %} {% for result in page_obj.object_list %} <div class="col-md-2"> <div class="cell"> <div class="description"> {{ result.object.Studiengang }} </div> </div> </div> <div class="col-md-2"> <div class="cell"> <div class="description"> <p>{{ result.object.Bildungsinstitut }}</p> ... {% empty %} <p>No results found.</p> {% … -
Django edit model template - How do I only select the text value to show in an edit template of a (foreign key) model dropdown?
I am working on an edit view for my model that has a reference to another table. The model I am working with looks like this: class SkillSet(models.Model): SKILL_LEVEL_CHOICES = ( (0, 'None'), (1, 'Basic'), (2, 'User'), (3, 'Advanced'), ) rating = models.ForeignKey(Rating, on_delete=models.CASCADE) skill = models.ForeignKey(Skill) skillLevel = models.IntegerField(choices = SKILL_LEVEL_CHOICES, default = 0) notes = models.TextField(null=True, blank=True) I created a form for it that you can see here: class SkillSetEditForm(forms.ModelForm): class Meta: model = SkillSet fields = [ "skill", "skillLevel", "notes" ] labels = { 'skill': ('Skill'), 'skillLevel': ('Skill Level'), 'notes': ('Notes'), } and after that I put it inside my view like this: {% for skillForm in skillForms %} <tr class="nivEdit" style="display:none;"> <td>{{ skillForm.skill }}</td> <td>{{ skillForm.skillLevel }}</td> <td>{{ skillForm.notes}}</td> </tr> {% endfor %} And the end result looks good but I don't want my user to be able to edit the skill itself, just the level and the notes. I can get the value but this is just the underlying ID of the skill model. Is there a way for me to select the shown text from the dropdown? I could do it with jquery/javascript but it would get quite messy and I would expect that … -
what is the settings for django rest framework swagger open api security object definition for oauth2 flow being password?
I am using django, rest_framework and rest_framework_swagger to build an api with docs. How do i select an authentication scheme? Right now i am using oauth2 password based authentication to obtain my token and use Bearer {{access_token}} in my header. The method i have used here was acquired from my previous work place. Swagger works when my end points work for anonymous users. It fails to display the end points when they require authentication header. I tried below code in vein SWAGGER_SETTINGS = { 'SECURITY_DEFINITIONS': { 'api_key': { 'type': 'apiKey', 'in': 'header', 'name': 'Authorization' } }, } SWAGGER_SETTINGS = { 'SECURITY_DEFINITIONS': { "oauth": { "type": "oauth2", "tokenUrl": "http://127.0.0.1:8000/o/token", "flow": "password", "scopes": { "admin": "admin scope", "user": "users scope" } } when i click on Authorise button on top right and again Authorise on the popup, the page leads to http://127.0.0.1:8000/docs/null&redirect_uri=http%3A%2F%2F127.0.0.1%3A8000%2Fdocs%2Fo2c.html&realm=your-realms&client_id=your-client-id&scope=admin%2Cuser&state=undefined I found these pages usefull: OpenAPI, Blog Post on Swagger and OAuth2, What are scopes and Swagger tutorial -
Django Admin - add a new block that can be set in admin.py?
ive copied the change_form from the admin dir into my own dir. Ive added a new block named extra_content as per the below {% block inline_field_sets %} {% for inline_admin_formset in inline_admin_formsets %} {% include inline_admin_formset.opts.template %} {% endfor %} {% endblock %} {% block after_related_objects %}{% endblock %} {% block extra_content %} {% include '{{ ?? }}' %} {% endblock %} {% block submit_buttons_bottom %}{% submit_row %}{% endblock %} inside that block i have an include, and i was wondering if i could set what file that include would pull in admin.py? Thanks -
How do i get to collect static files ? i cant run this project it raises the error
Im running the command python manage.py collectstatic You have requested to collect static files at the destination location as specified in your settings: /static python manage.py collectstatic This will overwrite existing files! Are you sure you want to do this? Type 'yes' to continue, or 'no' to cancel: yes the error im gettting; Can't open file "/static/fonts/FreeSans.ttf" Copying '/home/mark/Desktop/xls/python-django-exporting-files/static/js/bootstrap.min.js' Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/home/mark/.virtualenvs/test/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line utility.execute() File "/home/mark/.virtualenvs/test/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/mark/.virtualenvs/test/local/lib/python2.7/site-packages/django/core/management/base.py", line 390, in run_from_argv self.execute(*args, **cmd_options) File "/home/mark/.virtualenvs/test/local/lib/python2.7/site-packages/django/core/management/base.py", line 441, in execute output = self.handle(*args, **options) File "/home/mark/.virtualenvs/test/local/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 168, in handle collected = self.collect() File "/home/mark/.virtualenvs/test/local/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 107, in collect handler(path, prefixed_path, storage) File "/home/mark/.virtualenvs/test/local/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 315, in copy_file self.storage.save(prefixed_path, source_file) File "/home/mark/.virtualenvs/test/local/lib/python2.7/site-packages/django/core/files/storage.py", line 64, in save name = self._save(name, content) File "/home/mark/.virtualenvs/test/local/lib/python2.7/site-packages/django/core/files/storage.py", line 223, in _save os.makedirs(directory) File "/home/mark/.virtualenvs/test/lib/python2.7/os.py", line 150, in makedirs makedirs(head, mode) File "/home/mark/.virtualenvs/test/lib/python2.7/os.py", line 157, in makedir mkdir(name, mode) OSError: [Errno 13] Permission denied: '/static' The error im gettting in the browser; Can't open file "/static/fonts/FreeSans.ttf" TTFError at / Can't open file "/static/fonts/FreeSans.ttf" Request Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 1.8.2 Exception Type: TTFError Exception Value: … -
Assigning a value to a ManyToManyField
This is my first time using M2M relationship in django.This is what I am trying to accomplish. I have a patient model modelPatient that can be assigned to multiple students (medical students) and each student modelStudentcan have multiple patients to examine. For this purpose I decided to use M2M relationship here. Please let me know if this is the correct design decision in this case. class modelPatient(models.Model): student = models.ManyToManyField(modelStudent,null=True,default=None,blank=True) patient_name = models.CharField(max_length=128, unique=False) and this is the student model class modelStudent(models.Model): first_name = models.CharField(max_length=128, unique=False) Now suppose I am doing something like this patient = modelPatient.object.get(patient_name="John") How can I assign this patient to multiple students studentA and studentB studentA = modelStudent.objects.get(first_name="john") studentB = modelStudent.objects.get(first_name="adam") what I want here is have the patient instance associated with both studentA and studentB. Please let me know if this is possible or if my design decision is incorrect. -
Content type dropdown not displayed django admin form
This is a Post model and when I open it in django admin to add posts, I see a field content type but there exist no drop-down to select the content type. Am I doing something wrong here? class Post(commons_models.CalyxBaseModel): FEATURE_LIMITS = models.Q(app_label=u'forums', model=u'forum') content_type = models.ForeignKey(ContentType, limit_choices_to=FEATURE_LIMITS, on_delete=models.CASCADE) object_id = models.PositiveIntegerField() content_object = GenericForeignKey('content_type', 'object_id') admin.py for posts # imports admin.site.register(posts_models.Post) There is a model Forum, which has a generic relation with post. class Forum(commons_models.CalyxBaseModel): # other fields posts = GenericRelation(Post) The post field is not visible on django admin(other fields are visible). admin.py for forums # imports admin.site.register(forums_models.Forum) If I make changes to admin.py : class PostInline(GenericTabularInline): model = Post class ForumAdmin(admin.ModelAdmin): inlines = [ PostInline, ] admin.site.register(forums_models.Forum, ForumAdmin) Then on hitting http://localhost:8000/admin/forums/forum/add/, the page keeps loading forever. -
How to use images loaded with webpack in django templates?
I am using Webpack 2 and use url-loader to load all of my images. before using webpack, I used the static template tag like this: <img src="{% static "img.png" %}" ... /> and now webpack renames all of the images to some hash and ext like this: img.png becomes img-[somehash].png. (I use this for cache invalidation). the problem is how to load the new image (with the hash) in django templates ?! thanks in advance. -
Python - Invalid Syntax with Manage.Py
Here's the code from the manage.py file from a Python project I'm working on. At line 14 where it goes "from exc" I am getting an error message saying it's invalid syntax. What am I doing wrong? I can't run the rest of my app :( #!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings") try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" ) from exc execute_from_command_line(sys.argv) -
how to put a js on the top level domain in django
I am implementing onesingal push notification on my website by reading there documentation OneSignal WebPush notification. There they say that put the corresponding javascript on the top level domain ? In django all files are located through the route so how i should put a js on the top domain level? eg https://yoursite.com/manifest.json https://yoursite.com/OneSignalSDKWorker.js -
Compress Zip in TimedRotatingFileHandler log file into Django using python3
I want to compress log rotation file into zip format. encoding': 'bz2' is not working with my python3 code. How can i solve this issue using djnago? Here is my code: LOG_DIR = os.path.join(BASE_DIR, 'logs') LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'standard': { 'format': '%(levelname)s: %(asctime)s %(message)s', }, }, 'handlers': { 'automate_bmw': { 'level': 'DEBUG', 'filename': os.path.join(LOG_DIR, 'automate_bmw.log'), 'class': 'logging.handlers.TimedRotatingFileHandler', 'backupCount': 20, 'when': 'm', 'encoding': 'bz2', 'interval': 1, 'formatter': 'standard', }, 'locations':{ 'handlers': ['locations'], 'level': 'DEBUG', 'propagate': True, }, }