Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Rendering ordered reversed dictionary value in Django template
Demo.html I need output with sorted value of Coverage attribute. <table> <tr > <th>Test Case</th> <th>File Name</th> <th>Coverage</th> </tr> {% for key, value in d.items %} <tr> <td>{{ key }}</td> </tr> {% for k,v in value.items|dictsortreversed:"0.lower" %} <tr> <td> </td> <td>{{ k }}</td> <td>{{ v }}</td> </tr> {% endfor %} {% endfor %} </table> I need to sort dictionary based on Coverage attribute i'm trying to do by using dictsort:"0.lower" but its sorting based on file name attribute but if i use dictsort:"1.lower" value is not printing.I need sorting on value (Coverage). Please do help me out. -
Django: TypeError at /1/ context must be a dict rather than QuerySet
this is my first Post on this Site. I am learning Django and Python right now and trying to create a Quiztool. I have hughe problems with creating my views and its hard for me to understand how to refine the data in a Queryset. In my Detail View I am raising this error: TypeError at /1/ context must be a dict rather than QuerySet. Request Method: GET Request URL: http://192.168.188.146:8080/1/ Django Version: 2.0.1 Exception Type: TypeError Exception Value: context must be a dict rather than QuerySet. Exception Location: /home/flo/Django2.0/lib/python3.5/site-packages/django/template/context.py in make_context, line 274 Python Executable: /home/flo/Django2.0/bin/python Python Version: 3.5.3 Python Path: ['/home/flo/Django2.0/quiztool', '/home/flo/Django2.0/lib/python35.zip', '/home/flo/Django2.0/lib/python3.5', '/home/flo/Django2.0/lib/python3.5/plat-x86_64-linux-gnu', '/home/flo/Django2.0/lib/python3.5/lib-dynload', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/home/flo/Django2.0/lib/python3.5/site-packages'] Server time: Thu, 1 Mar 2018 11:00:35 +0000 I know I have to put the Queryset into a Dictonary but i dont know how to do this. Here is my views.py: def index(request): latest_survey_list = Survey.objects.order_by('survey_id')[:5] context = { 'latest_survey_list': latest_survey_list } return render(request, 'fragen/index.html', context) def detail(request, survey_id): question = Survey.objects.get(pk=survey_id).question.all().values() question_dict = { 'question': question } return render(request, 'fragen/detail.html', question) And here the detail.html: {% if question %} <ul> {% for x in question %} <li>{{ x.question_text }}</li> {% endfor %} </ul> {% else %} <p>No questions are … -
How do I remove from Django widgets HTML5 attributes
Django Widgets set HTML5 maxlength attribute, based on the Model max_length. I want to remove this attribute, because is interfering with my own validation, which is more complex. I know that required attribute can be set to false, but I don't know for other html5 attributes. -
Exclude a package if DEBUG=True
If DEBUG=True, I want to exclude the package storages. How would I do this? my settings.py: if DEBUG: storages = '' INSTALLED_APPS = [ ... 'app', storages, -
Regroup django list by Foreign key in template
I am trying to create a tab based view using Djanog regrouop. My model class FaqCategory(BaseModel): name = models.CharField(max_length=50, unique=True) def __str__(self): return str(self.name) class Meta: ordering = ['-id'] class Faq(BaseModel): holiday = models.ForeignKey(to='Holiday',on_delete=models.CASCADE) category = models.ForeignKey(to='FaqCategory', on_delete=models.CASCADE) question = models.CharField(max_length=500) answer = models.TextField() class Meta: ordering = ['-id'] I am trying to create something like this When I try to add another question and answer it becomes this Can't group category name and question. My code <div class="col-lg-2"> <ul class="nav nav-tabs tabs-left custom-tabs"> {% regroup single.faq_set.all by category as category_list %} {% for category in category_list %} <li class="{% if forloop.first %} {{'active'}} {% endif %} "> <a href="#{{ category.grouper|slugify }}" data-toggle="tab">{{ category.grouper }}</a> </li> {% endfor %} </ul> </div> -
Is there an equivalent of django template comments for standalone JavaScript files?
I checked PyCharm knowledge base and "Google" but could not find if there is an equivalent to django template comments for "standalone" JavaScript files. In Django, the following is not rendered when producing html pages (which also works for JavaScript code if it is in the template file): {# this won't be rendered #} source: https://docs.djangoproject.com/en/dev/topics/templates/#comments Because I would like to separate JavaScript code from the template (and put it in mySeparetedJjCode.js), the django template {# comment #} does not work anymore. does someone know a solution for this? -
Django Foreign Key in View - get first image to show for each user in list
I'm trying to make my dashboard show a list of users in your area. This so far works but I can not get the user's fist image to show. The current error message I am getting is "'QuerySet' object has no attribute 'id'" models.py class Images(models.Model): image = models.ImageField(upload_to='profile_image', null=True, default='profile_image/none/no-img.png') user = models.ForeignKey(User, on_delete=models.CASCADE, null=False) views.py class DashboardView(TemplateView): template_name = 've/cp/dashboard.html' @method_decorator(login_required) def dispatch(self, *args, **kwargs): return super(DashboardView, self).dispatch(*args, **kwargs) def get(self, request, pk=None): users = User.objects.exclude(id=request.user.id) user = User.objects.filter(pk=pk) try: favorite = Favorite.objects.get(current_user=request.user) favorites = favorite.users.all() except Favorite.DoesNotExist: favorites = None args = { 'users': users, 'favorites':favorites, 'images': Images.objects.filter(user_id=user.id) } return render(request, self.template_name, args) dashboard.html <h2>People near you</h2> {% for user in users %} <a href="{% url 've:view_profile_with_pk' pk=user.pk %}"> <h4>{{ user.username }}</h4> <p>{{ user.images }}</p> {% if images %} {% for img in images %} <a href="{{ img.image.url }}" target="_blank"> <img src="{{ img.image.url }}" class="" style="max-width: 300px"> </a> {% endfor %} {% else %} <p>No images</p> {% endif %} </a> {% if not user in favorites %} <a href="{% url 've:change_favorites' operation='add' pk=user.pk %}"> <button type="button" class="btn btn-success">Add Favorite</button> </a> {% endif %} {% endfor %} -
HTML button dosen't call JavaScript-method
I have an HTML-button that a user can click to register an account: <button onclick="redirectToHomePage()" class="ok-button" > Register</button> Unfortunately, the JavaScript-method is never called. The strange thing is, when I replace the button with "input": <input onclick="redirectToHomePage()" class="ok-button" > Register</input> The method is called. So it works with "input", but not with "button". Does anyone know what the issue could be? Thank you! -
django replace whispace in url with plus sign
i have names in my models that are separated by whitespace. Example: Don Joe and it's k..i wanted it like this but in the urls it shows up like this https://example.com/details/Don Joe i want to replace that whitespace with a plus sign +. This is part of my urls.py url(r'^(?P<ps_name>.+)$', views.details, name='details'), This is part of my main.html {% for ps in users %} <tr> <td> <a href="{% url 'main:details' ps_name=ps.ps_name %}">{{ ps.ps_name }}</a> </td> </tr> {% endfor %} And this is part of my views.py def details(request, ps_name): ps = Seotube.objects.filter(ps_name=ps_name) name = str(ps_name) return render(request, 'main/details.html', {'name': name, 'pornstars': ps}) I do want to keep the name normal with whitespace only in the url i want to have a plus sign instead of whitespace. Because i also call that name in in the details.html {% if name %} <h1> {{ name }}</h1> {% endif %} Thank you -
Django Migration Doesn't Work
i'm trying to make migrations for my app. It is not the first time that I have migrated and have always worked. But this time it seems they have worked and instead the database is not updated. These are my models: class Bambino(models.Model): nome = models.CharField(max_length=50) cognome = models.CharField(max_length=50) data_nascita = models.DateField(auto_now=False, auto_now_add=False) sesso = models.CharField(max_length=1) def __unicode__(self): return self.nome + ' ' + self.cognome + ' ' + self.sesso class Gioco(models.Model): nome = models.CharField(max_length=200) def __unicode__(self): return self.nome class Terapia(models.Model): id_bambino = models.ForeignKey(Bambino, on_delete = models.CASCADE, default='1') id_gioco = models.ForeignKey(Gioco, on_delete = models.CASCADE, default='1') nome = models.CharField(max_length=50) data_inizio = models.DateField(auto_now=False, auto_now_add=False) data_fine = models.DateField(auto_now=False, auto_now_add=False) def __unicode__(self): return self.nome Then i run the following commands: python manage.py migrate python manage.py makemigrations (and create the file 0001_initial.py) python manage.py sqlmigrate appname 0001 (here shows changes in database and then COMMIT) python manage.py migrate (this time nothing is happening) If I check the database this is not updated. This is the code into my 0001_initial.py from _future_ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Bambino', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('nome', models.CharField(max_length=50)), ('cognome', models.CharField(max_length=50)), ('data_nascita', … -
Serving Django with apache 2.4 mod_wsgi
I have installed apache 2.4 and apache service and it is running without problems. I have modified the httpd.conf file following this link When I call the localhost in my browser, it keeps trying to load (the icon of the tap is a rotating circle) and no error message or a content appears in the page. My changes in httpd.conf Include "F:/mysite/apache/apache_django_wsgi.conf" apache_django_wsgi.conf Alias /site_media/ "F:/mysite/media/" <Directory "F:/mysite/media"> Require all granted Options Indexes IndexOptions FancyIndexing </Directory> Alias /site_static/ "F:/mysite/static/" <Directory "F:/mysite/static"> Require all granted Options Indexes IndexOptions FancyIndexing </Directory> WSGIScriptAlias / "F:/mysite/apache/my_app.wsgi" <Directory "F:/mysite/apache"> Require all granted </Directory> my_app.wsgi import os, sys pathlist = ['F:/mysite','F:/mysite/my_app','C:/Python27/Scripts', 'C:/Python27/Lib/site-packages'] [sys.path.insert(0, path) for path in pathlist if path not in sys.path] os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' from django.core.wsgi import get_wsgi_application application = get_wsgi_application() mysite.setting.py: ALLOWED_HOSTS = ['localhost'] WSGI_APPLICATION = 'mysite.wsgi.application' ROOT_URLCONF = 'mysite.urls' Is there any mistake or missing things? Thank you for your help. -
Telnet honeypot errors
root@honeypot:~/telnet-iot-honeypot# python backend.py Creating/Connecting to DB DB Setup done * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit) ^C root@honeypot:~/telnet-iot-honeypot# python honeypot.py 2018-03-01 08:50:39 telnet.py:57 Socket open on port 23 2018-03-01 08:50:57 telnet.py:72 Client connected at ('[REDACTED]', 59542) 2018-03-01 08:50:57 session.py:22 New Session Traceback (most recent call last): File "/root/telnet-iot-honeypot/honeypot/telnet.py", line 75, in handle sess.loop() File "/root/telnet-iot-honeypot/honeypot/telnet.py", line 96, in loop self.session = Session(self.send_string, self.remote[0]) File "/root/telnet-iot-honeypot/honeypot/session.py", line 26, in __init__ self.record = SessionRecord() File "/root/telnet-iot-honeypot/honeypot/sampledb_client.py", line 51, in __init__ self.back = get_backend() File "/root/telnet-iot-honeypot/honeypot/sampledb_client.py", line 14, in get_backend if _BACKEND: UnboundLocalError: local variable '_BACKEND' referenced before assignment https://github.com/Phype/telnet-iot-honeypot This honeypot is used to monitor port 23 or 2223 for incoming connections. I am getting this error whenever a client connects. How do I fix this? As you can see in the Traceback, there seems to be a problem with file paths or something. -
Get the django object backward using foreign key
I have 3 models using Django Framework: class Student(models.Model): name = models.CharField() surname = models.CharField() class Group(models.Model): groupId = models.AutoField() name = models.CharField() students = models.ForeignKey(Student) class Faculty(models.Model): facultyId = models.AutoField() students = models.ForeignKey(Student) I need to get the list of all students and for each one to have the student's group and faculty. -
django issue with {% url '..' %}
i don't know exactly how to explain this, but i will try...Something weird is going on with the linking of a tag...Basically when i link a <h1> tag or anything to go to another template tag, it doesn't work...it does change the url extension but it stays on the same template... I will show you the files now... This is the tree of the folder project: tube/ ├── main │ ├── admin.py │ ├── apps.py │ ├── __init__.py │ ├── migrations │ │ ├── __init__.py │ ├── models.py │ ├── tests.py │ ├── urls.py │ ├── views.py ├── manage.py ├── models.py ├── templates │ ├── base.html │ └── main │ ├── details.html │ └── main.html └── tube ├── __init__.py ├── settings.py ├── urls.py ├── views.py ├── wsgi.py main/views.py : class Main(TemplateView): template_name = 'main/main.html' def get_context_data(self, **kwargs): context = super(Main, self).get_context_data(**kwargs) test = Test.objects.all().order_by('ps_name') # for i in range(200): # lines.append('Line %s' % (i + 1)) paginator = Paginator(test, 20) page = self.request.GET.get('page') try: show_lines = paginator.page(page) except PageNotAnInteger: # If page is not an integer, deliver first page. show_lines = paginator.page(1) except EmptyPage: # If page is out of range (e.g. 9999), deliver last page of results. show_lines = … -
django rest framework error requiring a field
I've been following the tutorial at http://www.django-rest-framework.org/tutorial/4-authentication-and-permissions/ (which is pretty good) but I've got to the end and I'm running the command http -a admin:password123 POST http://127.0.0.1:8000/snippets/ code="print 789" and it gives me an error back: HTTP/1.1 400 Bad Request Allow: GET, POST, HEAD, OPTIONS Content-Length: 37 Content-Type: application/json Date: Wed, 28 Feb 2018 18:29:15 GMT Server: WSGIServer/0.2 CPython/3.6.3 Vary: Accept, Cookie X-Frame-Options: SAMEORIGIN { "owner": [ "This field is required." ] } The owner field is also visible on the browseable api giving options for all the users I've created. When saving it though (either browser or command line) it does save the user who made the request so that part is right. I think its not supposed to be visible on the browseable api and not required on the api call as it figures it out from the request. Here is my code: views.py: class SnippetList(generics.ListCreateAPIView): queryset = Snippet.objects.all() serializer_class = SnippetSerializer permission_classes = (permissions.IsAuthenticatedOrReadOnly,) def perform_create(self, serializer): serializer.save(owner=self.request.user) models.py: class Snippet(models.Model): created = models.DateTimeField(auto_now_add=True) title = models.CharField(max_length=100, blank=True, default='') code = models.TextField() linenos = models.BooleanField(default=False) language = models.CharField(choices=LANGUAGE_CHOICES, default='python', max_length=100) style = models.CharField(choices=STYLE_CHOICES, default='friendly', max_length=100) owner = models.ForeignKey('auth.User', related_name='snippets', on_delete=models.CASCADE) highlighted = models.TextField() class Meta: ordering = … -
500 (Internal Server Error) AJAX Django
all! Can u please help me? I have a small problem. When i click button, When I click on a button, a new object should be created without reloading the page. Only one parameter is required to create an object. The problem is that when you click the object is created (the new object is displayed in the admin panel), but in the console js there is an error: Failed to load resource: the server responded with a status of 500 (Internal Server Error) JS: function initBuyButton(){ $('.button-buy').click(function(e){ e.preventDefault(); var test = $(this); var smartphone_id = test.data("smartphone_id"); var url = test.attr("action"); basketUpdating(smartphone_id, url); }); } function basketUpdating(smartphone_id, url){ var data = {}; var csrf_token = $('#form_buying_product [name="csrfmiddlewaretoken"]').val(); data["csrfmiddlewaretoken"] = csrf_token; data.smartphone_id = smartphone_id; $.ajax({ url: url, type: 'POST', data: data, cache: true, }); } $(document).ready(function(){ initBuyButton(); }); View: def basket_adding(request): """Add new smartphone to basket.""" data = request.POST smartphone_id = data.get('smartphone_id') SmartphoneInBasket.objects.create(smartphone_id=smartphone_id) return True HTML: <form id="form_buying_product" > {% csrf_token %} {% for sm in smartphones %} ... <input type="submit" action="{% url 'basket_adding' %}" class="button- buy" data-smartphone_id = "{{ sm.id }}" value="Buy"> {% endfor %} </form> -
How to update table in postgresql in a Django app deployed in heroku?
I tried adding another column image of type ImageField to a model named Member but afterwards had to remove it. Now, if I try adding a member using Django admin, it gives this error: IntegrityError at /admin/robotronics/member/add/ null value in column "image" violates not-null constraint DETAIL: Failing row contains (10, Team, Faz, Azz, huv , Vz , null). I tried adding on development server and it works fine. It also works if I make another app and try to add new member. I used python manage.py shell and it shows no column named image. How can I update the old table in postgresql so that it does not have image field or at least set it to not null -
Django SSL with Nginx can't access
I'm using Django/uwsgi/nginx. And to access ssl, installed Lets encrypt. Below source is nginx and uwsgi confirue file. [project_rest.conf] upstream django {t server 127.0.0.1:8001; } server { listen 8000; server_name .mysitedomain.com; charset utf-8; client_max_body_size 75M; # adjust to taste # Django media location /media { alias /home/app/project_rest/media; # your Django project's media files - amend as required } location /static { alias /home/app/project_rest/static; # your Django project's static files - amend as required } # Finally, send all non-media requests to the Django server. location / { uwsgi_pass django; include /home/app/project_rest/uwsgi_params; # the uwsgi_params file you installed } listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/mysitedomain.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/mysitedomain.com/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } (I created project_rest.conf and link to /etc/nginx/sites-enabled/) [/etc/nginx/sites-available/default] server { # SSL configuration # # listen 443 ssl default_server; # listen [::]:443 ssl default_server; # # Note: You should disable gzip for SSL traffic. # See: https://bugs.debian.org/773332 # # Read up on ssl_ciphers to ensure a secure configuration. # See: https://bugs.debian.org/765782 # # Self signed certs generated by the ssl-cert package # Don't use them in a production server! # … -
Django dynamic objectlist in for loop
I have a nested for loop in which the inner loop's object list is to filled in by the outerloop Template {% for currency in currencies %} {% for transaction in transactions_{{currency}} %} //content here {% endfor %} {% endfor %} View.py currencies = ['usd', 'inr'] context['currencies'] = currencies for currency in currencies: context['transactions_'+currency] = access.listtransactions(self.request.user.username) What i need is the inner loop to translate as follows {% for currency in currencies %} // {{currency}} iterates to usd {% for transaction in transactions_usd %} currently i am receiving the following error TemplateSyntaxError at /transaction/ Could not parse the remainder: '{{currency}}' from 'transactions_rcv_{{currency}}' Is there anything i missed or alternative function? Any guidance would be appreciated. -
about Python Django Administration page's appearance
I am a beginner of python Django .i created a django administration page but it was some problem with css.this is the screen shot of the that page.i want to be that like this. this is the what i wanted page's screen shot. anyone can help me? -
Elastic Beanstalk not deploying on all instances
I have a Django application that I deploy through EB. I had the auto-scaling policy set to min. and max. 1 instance. This was working fine. Then I just chnaged the auto scaling to min. and max. 2 instances. The new instance automatically came up. But the application was not deployed to the new one. I manually deployed but still no difference. Tried the deployment policy to rolling and all at once and still the same. The new instance doesn't have any code in it. The ELB says the instances are fine and tries to send traffic to the new instance which results in a Not Found Page. What should I do? -
Django - transaction.atomic rollback after particular time
I am trying to create a booking app using django. In my application the user can select a seat and make payment within 5 mins. When a user selects a seat the state will be changed to blocked. If payment not done within 5 mins the selected seat state should change to available. I am not aware of how to implement that using transaction.atomic(). Generally incase of an exception rollback can be achieved but here how do I achieve that. with transaction.atomic(): seat = Room.objects.get(account_id=location.id, seat_no=seat_no) seat.state = blocked seat.save() How do I revert the status to available if payment not done in next 5 mins? -
How to add Django's CSRF token to the header of a jQuery POST request?
I'm trying to make a Django form with dynamically pre-populated fields: that is, when one field (checkin_type) gets selected from a drop-down menu, other fields get automatically pre-populated with corresponding data. To this end, I would like to send a POST request to the server as soon as a drop-down option is selected. So far I've tried the following template (following https://docs.djangoproject.com/en/2.0/ref/csrf/): <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script> <script> $(document).ready(function(){ var csrftoken = Cookies.get('csrftoken'); $(".auto-submit").change(function() { $.post({ url: "{% url 'get-checkin-type' %}", data: $(".auto-submit option:selected").val(), headers: { X-CSRFToken: csrftoken } }) }); }); </script> <form action="" method="post">{% csrf_token %} {% for field in form %} <div class="{% if field.name == 'checkin_type' %}auto-submit{% endif %}"> {{ field.errors }} {{ field.label_tag }} {{ field }} </div> {% endfor %} <input type="submit" value="Send message" /> </form> However, when I select a drop-down option I get a new:17 Uncaught SyntaxError: Unexpected token - which emanates from the X-CSRFToken: csrftoken line: Can someone point out to me what is wrong with this code? (I tried looking it up from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Unexpected_token but so far couldn't figure it out). By the way, it seems from jQuery add CSRF token to all $.post() requests' data that one can also add … -
Convert CGI to Django framework
Can anyone help me on what approache should be used to convert a CGI script to Django Framework? I will need to use HTTP Get method request from an HTML Form to obtain user inputs and inject them into a python script. Here is a sample of CGI python script: #!/usr/bin/python import cgi, cgitb from RTTexec import * # from RTTexecCustom import * from globals import * form = cgi.FieldStorage() print "Content-Type: text/html" print "" print "<html>" print "<head>" print "<title>RTT</title>" print '<link rel="stylesheet" href="../jquery-ui-1.11.4.custom/jquery-ui.css">' print "</head>" print "<body>" print '<div class="inside">' print '<p>' print "The user entered data are:<br>" step = 0 try: execTypeExtract = '' execTypeExec = '' try: execTypeExtract = form["execTypeExtract"].value except: None try: execTypeExec = form["execTypeExec"].value except: None try: info = form["information"].value except: None if execTypeExtract != '' and execTypeExec != '': executionIncludes = execTypeExtract+'_'+execTypeExec elif execTypeExtract != '': executionIncludes = execTypeExtract elif execTypeExec != '': executionIncludes = execTypeExec else: step = 1 print "<b>execution Includes:</b> " + executionIncludes + "<br>" -
Django on Apache2 (Ubuntu 16.04) reports 'No module named mysite.settings'
I'm running Apache 2.4.18 on Ubuntu 16.04. I've set up a virtual server with the following settings. The virtual host has been registered with a2ensite and appears to be being accessed ok. <VirtualHost *:80> ServerName www.factsfromfigures.com WSGIScriptAlias / /home/user/mycode/mysite/mysite/wsgi.py <Directory /home/user/mycode/mysite/> <Files wsgi.py> Require all granted </Files> </Directory> </VirtualHost> When it runs I get the following error in the Apache log. [Thu Mar 01 17:35:00.968878 2018] [wsgi:error] [pid 12278] [client 192.168.1.68:61552] mod_wsgi (pid=12278): Target WSGI script '/home/user/mycode/mysite/mysite/wsgi.py' cannot be loaded as Python module. [Thu Mar 01 17:35:00.968895 2018] [wsgi:error] [pid 12278] [client 192.168.1.68:61552] mod_wsgi (pid=12278): Exception occurred processing WSGI script '/home/user/mycode/mysite/mysite/wsgi.py'. [Thu Mar 01 17:35:00.968923 2018] [wsgi:error] [pid 12278] [client 192.168.1.68:61552] Traceback (most recent call last): [Thu Mar 01 17:35:00.968933 2018] [wsgi:error] [pid 12278] [client 192.168.1.68:61552] File "/home/user/mycode/mysite/mysite/wsgi.py", line 18, in <module> [Thu Mar 01 17:35:00.968964 2018] [wsgi:error] [pid 12278] [client 192.168.1.68:61552] application = get_wsgi_application() [Thu Mar 01 17:35:00.968971 2018] [wsgi:error] [pid 12278] [client 192.168.1.68:61552] File "/usr/lib/python2.7/dist-packages/django/core/wsgi.py", line 14, in get_wsgi_application [Thu Mar 01 17:35:00.968988 2018] [wsgi:error] [pid 12278] [client 192.168.1.68:61552] django.setup() [Thu Mar 01 17:35:00.968992 2018] [wsgi:error] [pid 12278] [client 192.168.1.68:61552] File "/usr/lib/python2.7/dist-packages/django/__init__.py", line 17, in setup [Thu Mar 01 17:35:00.969007 2018] [wsgi:error] [pid 12278] [client 192.168.1.68:61552] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) …