Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
'module' object has no attribute 'post' Django 1.10 (Ipn check)
Hi have ipn check function, when testing it i recieve error: resp = requests.post(self.OKPAY_VERIFICATION_URL, data=verify_request_payload, headers=headers) AttributeError: 'module' object has no attribute 'post' Here code of function, _request_data is QueryDict object. Thx for help def verify_ipn(self): self.__verification_result = False headers = { 'Content-Type': 'application/x-www-form-urlencoded', } verify_request_payload = { 'ok_verify': 'true', } verify_request_payload.update(self._request_data) resp = requests.post(self.OKPAY_VERIFICATION_URL, data=verify_request_payload, headers=headers) msg = 'resp is {} for verification of request {}'.format( resp.content, verify_request_payload ) self.logger.info(msg) if resp.content == self.OKPAY_IPN_VERIFIED: # self.__verification_result = True return self.__verification_result -
Form field not displaying in Django extended form
I'm trying to extend AuthenticationForm from django.contrib.auth.forms as follows, however my template isn't displaying the CharField password. How do I get it to work? I've noticed it works correctly with a CBV, but not with a function view. Why not? forms.py: from django.contrib.auth.forms import AuthenticationForm class ReauthForm(AuthenticationForm): username = forms.CharField(max_length=254) password = forms.CharField(label=_("Password"), widget=forms.PasswordInput) class Meta: exclude = ("username",) fields = ("password",) views.py: def reauth(request, *args, **kwargs): if request.method == 'POST': pass else: form = ReauthForm() context = {'username':request.user.username} return render(request, 'reauth.html', context) reauth.html: {% extends "base.html" %} {% block content %} <div class="margin clb"> <b class="clb cl">Enter your password:</b> <br><br> <form method="post" action="{% url 'reauth' %}"> {% csrf_token %} <input type="hidden" name="username" value="{{ username }}"> {{ form.password }}<br> <input class="btn bcg mtl" type="submit" value="OK"> </form> <br> </div> <br><br> {% endblock %} urls.py: url(r'^reauth/$', auth(reauth), name='reauth'), The result: -
How can I save an string pk into int pk?
I have a problem with a submit form when I want to save the profile ID the form have an error, i dont understand why because in the console all is ok but the form_valis is false, so think because the ModelChoiseField send a pk in sting format so how can i convert the string pk to int pk ? My Form class UsuarioForm(forms.ModelForm): id_perfil = forms.ModelChoiceField(queryset=Perfil.objects.filter(status='1'), label="Perfil" ,empty_label="Seleciona perfil", widget=forms.Select(attrs={'class':'form-control'})) My Models class Usuario(models.Model): id_usuario = models.AutoField(primary_key=True) nombre = models.CharField(max_length=255) id_perfil = models.IntegerField() status = models.CharField(max_length=50) class Perfil(models.Model): id_perfil = models.AutoField(primary_key=True) nombre = models.CharField(max_length=255) status = models.CharField(max_length=50) enter image description here enter image description here -
Changing Twitter and Facebook share images on click
Where I'm at I have a series of 30 slides and as you scroll down the page an anchor gets appended to the url (eg. #day1, #day2, #day3 ... #day30) I'm looking for a way to change the meta name="twitter:image and meta property="og:image" so when the user is on slide/#day3 and the link gets clicked, the url is for corresponding day's image day3.jpg I will be pulling the data for each of these slides from data.js which is in JSON format scripts.js $('.twitter-slide').click(function() { $('meta[property="og:image"]').attr('content', 'linkToPicture'); }); data.js var data = [ { "Day": 1, "Slide": "#day1", "Description": "Hungry by early afternoon. Thinking about all foods as either forbidden or compliant constantly.", "Extra": "", "Tweet": "Hungry by early afternoon.", "Background": "#ffffd9", "Font": "#111", "Image": "" }, { "Day": 2, "Slide": "#day2", "Description": "Ate a whole avocado and truckful of nuts as late afternoon snack. Still feeling low key hungry.", "Extra": "", "Tweet": "Ate a whole avocado and truckful of nuts as late afternoon snack.", "Background": "#ffffd9", "Font": "#111", "Image": "" }, { "Day": 3, "Slide": "#day3", "Description": "Have three water-based beverages at my desk: Ice water, hot water and water with lemon.", "Extra": "", "Tweet": "Have three water-based beverages at … -
nginx+gunicorn+django/mezzanine not serving static files
I have a mezzanine app. I am using gunicorn as the webserver and nginx as a reverse proxy. However, static files are not being served (however, they are served via the built-in django development server). I have run python manage.py collectstatic. Here is my nginx.conf file: worker_processes 1; events { worker_connections 1024; } http { sendfile on; gzip on; gzip_http_version 1.0; gzip_proxied any; gzip_min_length 500; gzip_disable "MSIE [1-6]\."; gzip_types text/plain text/xml text/css text/comma-separated-values text/javascript application/x-javascript application/atom+xml; # Configuration containing list of application servers upstream app_servers { server 127.0.0.1:8080; # server 127.0.0.1:8081; # .. # . } # Configuration for Nginx server { # Running port listen 80; # Settings to serve static files location ^~ /static/ { # Example: # root /full/path/to/application/static/file/dir; root /root/myapp/myapp/static/; } # Serve a static file (ex. favico) # outside /static directory location = /favico.ico { root /app/favico.ico; } # Proxy connections to the application servers # app_servers location / { proxy_pass http://app_servers; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Host $server_name; } } } What can I do to serve static files? -
How to create an object with link to nested object from id's in POST
I'm trying to get my head around how to cope with nested models in django-rest-framework (DRF). I have read this part of the documentation, which deals with writing a serializer that can save nested objects, but it's not exactly what I want. In a post I have the id's of related (many-to-many) objects. Example: Lets say that I have a Match (think soccer, tennis) and a match is between 2 teams, and the teams consist of players. I want to sent a POST with the match-info and the player-ids. If the players have played before there is already a team, otherwise we should make the team. If player 1 played game 4 against player 2, the POST would look something like team_1[player_1_id]:1 team_2[player_1_id]:2 game:4 The fact that all sorts of stuff needs to be done I thought maybe the view was a good place: I need to shuffle around some data before it's ready for a serializer anyway; but how do I start? I can override the perform_create to do magic like so: class MatchViewSet(viewsets.ModelViewSet): queryset = Match.objects.all() serializer_class = MatchSerializer def perform_create(self, serializer): // get the user ids form the post // find if there is are teams, otherwise … -
Django Document upload issue does not show "no file selected"
I have the following form: <form method="post" enctype="multipart/form-data"> {% csrf_token %} {{ form.as_p }} <button type="submit">Upload</button> </form> This produces a form which produces (in [] brackets denotes a button): **Document:** [Choose File] no file selected [Upload] When I use the following form: <form method="post" enctype="multipart/form-data"> {% csrf_token %} {{ form.document }} <button type="submit">Upload</button> </form> I don't get the "no file selected" part in Safari but I do in chrome. Is there some sort of "form.something" that will allow me to have it shown in whatever browser. Many thanks, Alan. -
Django Channels: send message on Group from worker process
The idea is to run a background task on the worker.connect worker. While executing the task, I would like to send its progress to a connected client via the notifications Group. The problem: the messages sent to the notifications Group are delayed until the task on the worker is finished. So: both messages 'Start' and 'Stop' appear simultaneously on the client, after a delay of 5 seconds (sleep(5)). I would expect the message 'Start', followed by a 5sec delay, followed by the message 'Stop'. Any idea why this is not the case? I have the following three processes running: daphne tests.asgi:channel_layer python manage.py runworker --exclude-channel=worker.connect python manage.py runworker --only-channel=worker.connect In views.py: def run(request, pk): Channel('worker.connect').send({'pk': pk}) return HttpResponse(status=200) In consumers.py: def ws_connect(message): Group('notifications').add(message.reply_channel) message.reply_channel.send({"accept": True}) def worker_connect(message): run_channel(message) In views.py: def run_channel(message): Group('notifications').send({'text': 'Start'}) sleep(5) Group('notifications').send({'text': 'Stop'}) routing.py channel_routing = { 'websocket.connect': consumers.ws_connect, 'worker.connect': consumers.worker_connect, } -
Django Reverse relationship with Recursive M2M Relationship
Trying to expand from the documentation in here : https://docs.djangoproject.com/en/1.10/topics/db/models/#extra-fields-on-many-to-many-relationships The context makes it easier to understand, Person object, M2M relationship with itself that defines 'relationship types' between two Persons, like Parent/Child/Engaged My Models.py : RELATIONSHIPS = ( (0, 'Child'), (1, 'Parent'), (2, 'Engaged'), ) class Person(models.Model): code = models.AutoField(primary_key=True, verbose_name="Person Code") name = models.CharField(max_length=150, blank=True, null=True, verbose_name="Name") relationships = models.ManyToManyField( 'self', through = 'Person_Person', #This lets you define the model that will act as an intermadiary symmetrical = False, #This needs to be set with recursive relationships ) class Person_Person(models.Model): person_1 = models.ForeignKey('Person', on_delete=models.CASCADE, related_name='%(class)s_person_1', verbose_name="Person 1") person_2 = models.ForeignKey('Person', on_delete=models.CASCADE, related_name='%(class)s_person_2', verbose_name="Person 2") relationship_type = models.IntegerField(choices = RELATIONSHIPS, default = 5, verbose_name="Relation") Test code : p1 = Person.objects.create(name = 'Man') p2 = Person.objects.create(name = 'Woman') relation = Person_Person(person_1 = p1, person_2 = p2, relationship_type = 2) reation.save() print(p1.relationships.all(), p2.relationships.all()) #>><QuerySet [<Person: 108 Woman>]> #>><QuerySet []> Now for the problem, p2's queryset for the relationship field returned empty, I understand why when you think about a non-recursive relationship, but in this case calling p2.relationships_set makes no sense, even if it did, how would I know a Person is the person_1 or person_2 of the relationship? Any suggestion is welcome -
The good way to do it in Django
I have created a template in Django, and it seems we can't use the notation {# Comment #}. How could I fix this issue in my project? Thanks in advance! -
How should I upgrade from bradjasper's django-jsonfield to Django's built-in jsonfield?
I have a Postgres 9.4 / Django 1.8 database that uses bradjasper's django-jsonfield package. (See https://github.com/bradjasper/django-jsonfield ) It works well, but I would like to upgrade the existing data to use Postgres 9.6 and Django 1.9's built-in JSONField. (See https://docs.djangoproject.com/en/1.10/ref/contrib/postgres/fields/#jsonfield ) This will allow more robust searches of JSON content. How do I upgrade the old database to the new one? What I've tried: I tried inserting a pair of schema migrations to Convert the bradjasper JSONField to a TextField. (This shouldn't change the database, since bradjasper stores data as a string.) Run Django's dumpdata command. Convert the TextField to Django's JSONField. (This should be a change in the database, from a text or json to jsonb.) Run Django's loaddata command. This gives an error like: u"[] (type <type 'unicode'>) is not a valid list for field url_methods"]: (myapp.mytable:pk=1) field_value was '[]' I'm looking at postgresql migrating JSON to JSONB and Upgrade PostgreSQL JSON column to JSONB? but am hoping to minimize the custom SQL. -
Ionic 2 login via django-registration view causes 403 error
I have trouble: I've ionic 2 app, in which user need login via form Django backend with django-registration for user registration/login/etc. Problem: Sending data via post request to django-registration login url causes 403 Forbidden error(Forbidden (CSRF token missing or incorrect.): /accounts/login/). So, my opinion, that in this case I can't fix it without changing user authentication library on backend side. But I need use those stack and those libraries. Commenting csrf middleware in settings file doesn't help. I've been tried use angular2-cookie from this answer, but it's still returning 403 error. Is there another way to solve this problem? -
Heroku Worker Timeout at 3 Minutes
I have a Django app on Heroku, and had moved some report processing code to a worker thread, as it can take some time to generate. Everything works fine, except in cases where the report generation will take more than three minutes. Every time I run it, at the 3 minute mark - give or take a second - I see "LOG: could not receive data from client: Connection reset by peer", in the logs and the the report processing seems to stop. It's not dying on the same player, or even in the same method, but always at the same time. Is there a time limit on worker dynos? I've been pouring through the docs the last couple hours and can't find any mention of one. Here's a snippet of the log: Jan 16 10:14:06 myapp app/worker.1: Generating all individual player reports Jan 16 10:14:06 myapp app/worker.1: Beginning loop of players Jan 16 10:14:06 myapp app/worker.1: Adding report data for player Jan 16 10:14:06 myapp app/worker.1: 0 Jan 16 10:14:06 myapp app/worker.1: In get_player_report_data Jan 16 10:14:06 myapp app/worker.1: In get player positions Jan 16 10:14:06 myapp app/worker.1: In score_data_for_metric_category ..... Jan 16 10:17:01 myapp app/worker.1: In get rank … -
Google Cloud Storage with Django getting 403
Hi I have Django web page and I am migrating to GCloud. I have successfully migrated the DB and now I am trying to migrate the Static and Media storages. I have this in my settings: INSTALLED_APPS.append('storages') GS_ACCESS_KEY_ID = env('GS_ACCESS_KEY_ID') GS_SECRET_ACCESS_KEY = env('GS_SECRET_ACCESS_KEY') GS_BUCKET_NAME = env('GS_BUCKET_NAME') from storages.backends.gs import GSBotoStorage StaticGStorage = lambda: GSBotoStorage(location='static') MediaGStorage = lambda: GSBotoStorage(location='media') MEDIA_URL = 'https://storage.googleapis.com/{}/media/'.format(GS_BUCKET_NAME) STATIC_URL = 'https://storage.googleapis.com/{}/static/'.format(GS_BUCKET_NAME) DEFAULT_FILE_STORAGE = 'config.settings.local.MediaGStorage' STATICFILES_STORAGE = 'config.settings.local.StaticGStorage' I followed this: Configure Django and Google Cloud Storage? In Access key env variables are values from "Interoperability" tab in Settings in GCloud Storage and I am 100% sure that they are loaded correctly. Also the bucket name is correct. But I am still getting this exception: boto.exception.GSResponseError: GSResponseError: 403 Access denied to 'gs://my-bucket-name/static/css/material.grey-orange.min.css' I get this exception from command: python manage.py collectstatic --noinput I should probably set something in the GCloud console but I have no idea what is wrong. Thanks for help -
Django template with multiple models
I have a template from which I need to render information from multiple models. My models.py look something like this: # models.py from django.db import models class foo(models.Model): ''' Foo content ''' class bar(models.Model): ''' Bar content ''' I also have a file views.py, from which I wrote according to this Django documentation and the answer given here, and looks something like this: # views.py from django.views.generic import ListView from app.models import * class MyView(ListView): context_object_name = 'name' template_name = 'page/path.html' queryset = foo.objects.all() def get_context_data(self, **kwargs): context = super(MyView, self).get_context_data(**kwargs) context['bar'] = bar.objects.all() return context and my urlpatterns on urls.py have the following object: url(r'^path$',views.MyView.as_view(), name = 'name'), My question is, on the template page/path.html how can I reference the objects and the object properties from foo and bar to display them in my page? -
Is that Django model query correct?
Is using such long queries a good approach? Or should it be done in other way? Is that good for SQL (postgres)? goodbills = Billinfo.objects.filter(status=20, lead_id__in=Lead.objects.filter(link_id__in=Link.objects.filter(partner=self.id, landing=eachlanding).values_list('id')).values_list('id')).count() -
Runserver issues with Django in Pycharm
I'm running Pycharm 2016.3.2 with Python 3.6 on Windows 10. I started up a django project, following the tutorial on the jetbrains website and when I try the command runserver from the manage.py view I get: Process finished with exit code -1073741819 (0xC0000005) Really confusing to me considering I did nothing different than what the tutorial was telling me. Running file from the command line with python manage.py runserver works perfectly. Any help would be appreciated. -
2 third party apps with the same name for the their template tags modules. How to load them?
app1 - templatetags - __init__.py - tags.py app2 - templatetags - __init__.py - tags.py If you do {% load tags %} in a template then one of these is used. How can you load app specific template tags? Is there any way that you can change the name of the tags of one app without affecting the actual file name? (they are 3rd party django apps) There is this similar question but in that case the module names are not the same, so it's a different situation. -
Managment forms data is missing or has been tampered with validation forms
I have searched everywhere but i could not get it resolved. I have a formset (table in the bottom) in my page. The main form and the formset need to be saved when i press a save button using ajax. The POST request is sent but there is error. ERROR "POST /new/ HTTP/1.1" 500 59 ValidationError: [u'ManagementForm data is missing or has been tampered with'] Views.py def master_detail_new(request): if request.method == 'GET': author = TmpPlInvoice() author_form = TmpForm(instance=author) BookFormSet = inlineformset_factory(TmpPlInvoice, TmpPlInvoicedet, exclude=('emp_id', 'voucher', 'lineitem', 'id',), form=TmpFormDetForm, ) formset = BookFormSet(instance=author) return render(request, 'main.html', {'form': author_form, 'formset': formset, 'formtotal': totalform, 'postform': postform}, ) elif request.method == 'POST': def get_new_voucher_id(): temp_vid = TmpPlInvoice.objects.order_by().values_list("voucher_id", flat=True).distinct() if not temp_vid: voucher_id = str(1).zfill(4) else: voucher_id = str(int(max(temp_vid)) + 1).zfill(4) return voucher_id author_form = TmpForm() author = TmpPlInvoice() BookFormSet = inlineformset_factory(TmpPlInvoice, TmpPlInvoicedet, exclude=('emp_id', 'voucher', 'lineitem', 'id',), form=TmpFormDetForm, extra=2) formset = BookFormSet(instance=author) voucher_id = get_new_voucher_id() author = TmpForm(request.POST) if author.is_valid(): created_author = author.save(commit=False) created_author.voucher_id = voucher_id created_author.save() formset = BookFormSet(request.POST, instance=created_author) if formset.is_valid(): formset.save() return HttpResponseRedirect('/') HTML <div class="x_content"> {{ formset.management_form }} {{ formset.non_form_errors.as_ul }} <table class="table table-striped responsive-utilities jambo_table bulk_action form" id="formset" style="background-color:#d0ffff;"> <thead style="background-color:#9df0e0;;color: #73879C"> {% for form in formset.forms %} {% if forloop.first … -
Integrity error: update or delete violates foreign key constraint. Django + PosrgeSQL
This my UserProfile modification class UserProfile(models.Model): user = models.OneToOneField(User) fb_id = models.IntegerField(primary_key=True,null=False,blank=True) follows = models.ManyToManyField('self', related_name='followed_by', symmetrical=False) User.profile = property(lambda u: UserProfile.objects.get_or_create(user=u)[0]) I am receiving the following error after trying to delete all test users or any single of them. django.db.utils.IntegrityError: update or delete on table "blog_userprofile" violates foreign key constraint "blog_from_userprofile_id_a482ff43f3cdedf_fk_blog_userprofile_id" on table "blog_userprofile_follows" DETAIL: Key (id)=(4) is still referenced from table "blog_userprofile_follows". Cascade deleting shall be true by default, why I am receiving this and how can I fix? I am using PostgreSQL + Django 1.8 -
Different app.yaml for given subdomain
We are developing our app locally on local.website.com, then uploading it to staging.website.com and finally to live environment - website.com. Those are 3 different servers. We've added following code to app.yaml: - url: /static/img static_dir: static/img secure: always expiration: "21d" http_headers: Cache-Control: "public, max-age=1814400" But unfortunatelly this Cache-Control interferes with our other scripts, while building locally on local.website.com. Is there any way to create different app.yaml for each subdomain, or build some logic around app.yaml to disable caching while on local.website.com? We are using Python 2.7 with Django framework. -
Django non-ORM models
I have some REST endpoints on guest server (/users, /companies, /etc). I need to create admin interface for it. I want to use django models with its relationships , but without database including. class User(models.Model): id = models.CharField() company = models.ForeignKey(Company) class Company(models.Model): name = models.CharField(max_length=255) I need to create CRUD interfaces with endpoints, which can helps me to do some my logic staff. For example, i need to update the same time User and Company. With ORM i can do it easily, but without database i can't do it. I found http://django-tastypie.readthedocs.io/en/latest/non_orm_data_sources.html. Can it helps me to create my wishes? Is there any good examples with providing tastypie with REST? -
Django and real time updates from the server on a REST resource
Context: I am using django (1.10) + django-restframework. I am implementing an application that will need real time updates from the server. I would like, from the frontend, to be able to receive live updates being performed on the database. I know that the solution is to use websockets. However, I'd like to avoid having to manage low-level websocket business. I was wondering if there is a high level solution that would integrate nicely with django and django-restframework and if not, it that would require a lot of work to do and where I should start. As a user, what I'd like to do would on the backend is to: # define a model class MyModel(models.Model): myField = models.CharField(max_length=128) # define a serializer class MyModelSerializer(serializers.ModelSerializer): class Meta: model = MyModel fields = ( 'myField', ) # define a class based view (a la django-restframework) class MyModelList(ListCreateAPIView): queryset = MyModel.objects.all() serializer_class = MyModelSerializer # define a path to this resource urlpatterns = [ url(r'^/api/my-models$', MyModelList.as_view(), name='my-model-list'), ] This defines a resource on the server. Then on the frontend I would like to: // create a real-time resource myModelResource = $rt_resource('/api/my-models'); myModelResource.fetch(function (myModels) { // Retrieve all the myModels from the list … -
Django contenttypes getting set to wrong value
I'm not a Django expert but working on getting a Django codebase into production. Going well so far except for one very strange bug. The app uses contenttypes heavily and in testing I noticed that in one of the tables, some rows got created with the wrong content_type_id. The content_type_id that got set for these records was totally unrelated, not part of any polymorphism. Furthermore, it led to fatal app errors (that's how I discovered it). Here is where I think the content_type_id is getting set. Does anything stand out about this? The model that was getting the wrong ID was Serving, which is here. Most of the content_type_ids pointed to food.serving, which is correct, but a few pointed to food.box_vote_job which doesn't make sense at all. One other thing that may be important: I upgraded the app from Django 1.3 to 1.8. I didn't see anything about contenttypes in the release notes as I moved from version to version but I may have missed it. I am at a loss -- how do I even debug this? Thanks for any help! -
Exception raised during haystack unit test
I'm using python 3.5.2, Django 1.9 and django-haystack 2.5.1. I have some models: class Annotation(TimeStampedModel): ... other attributes ... entity = models.ForeignKey('another_app.Entity', blank=True, null=True) class Entity(models.Model): ... other attributes ... I'm using this configuration in order to override the HAYSTACK_CONNECTIONS settings variable with another one (TEST_INDEX) which redirects all tests to a different search index. @override_settings(HAYSTACK_CONNECTIONS=TEST_INDEX, HAYSTACK_SIGNAL_PROCESSOR='haystack.signals.BaseSignalProcessor') class SearchEnpointsTests(OurAPITestCase): fixtures = ['test_data.json'] @classmethod def setUpClass(cls): super(SearchEnpointsTests, cls).setUpClass() haystack.connections.reload('default') call_command('update_index', interactive=False, verbosity=0) @classmethod def tearDownClass(cls): return super(SearchEnpointsTests, cls).tearDownClass() # call_command('clear_index', interactive=False, verbosity=0) test_search(self): ... And, as settings variables: # haystack: HAYSTACK_CONNECTIONS = { 'default': { 'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine', 'URL': ELASTICSEARCH_HOST, 'INDEX_NAME': 'haystack' } } TEST_INDEX = { 'default': { 'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine', 'URL': ELASTICSEARCH_HOST, 'INDEX_NAME': 'test_index', }, } Before configuring haystack real-time, it worked, now that I changed the configuration with this one: HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor' It raises an exception during testing: File "/project_folder/.venv/lib/python3.5/site-packages/django/db/models/fields/related_descriptors.py", line 160, in __get__ rel_obj = getattr(instance, self.cache_name) AttributeError: 'Annotation' object has no attribute '_entity_cache' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/project_folder/.venv/lib/python3.5/site-packages/django/test/testcases.py", line 1036, in setUpClass 'database': db_name, File "/project_folder/.venv/lib/python3.5/site-packages/django/core/management/__init__.py", line 119, in call_command return command.execute(*args, **defaults) File "/project_folder/.venv/lib/python3.5/site-packages/django/core/management/base.py", line 399, in execute output = self.handle(*args, **options) File "/project_folder/.venv/lib/python3.5/site-packages/django/core/management/commands/loaddata.py", line …