Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How can I update the database in Django?
I am building a web service and trying to update my db but obviously this is not the right method to do it. Can I have a helping hand here, I have tried all variations. I got this error: local variable 'Printer' referenced before assignment. I tried to change the name to PrinterObj but then I got the error: PrinterObj have no save method. What I want to do is to save to a new record if it is not existing and if it exist I want to update. I thought it should be simple. from .models import Printer class RequestData(APIView): permission_classes = (IsAuthenticated,) def get(self, request): Printer = Printer.objects.get(printername = printername) if Printer: #UPDATE Printer.printername = printername Printer.ip = request.META['REMOTE_ADDR'] Printer.lastupdate = datetime.now() Printer.save() else: #CREATE b = Printer( printername = printername, ip = request.META['REMOTE_ADDR'], lastupdate = datetime.now() ) b.save() -
How to add user Authentication with python, graphql, django, and Insomnia?
I'm following the graphql python tutorial at https://www.howtographql.com/graphql-python/4-authentication/. The section on Authentication, particularly where mentions using Insomnia, seems incomplete. I don't see the link between Insomnia and the tutorial. The author says, "Unfortunately, the GraphiQL web interface that we used before does not accept adding custom HTTP headers. From now on, we will be using the Insomnia desktop app. You can download and install it from here." Not even sure what Insomina is; looks like an endpoint/api tester like Postman? I am learning python, don't know Django or graphql, so it's a lot to digest all at once, but it was going ok until now. Also not sure what relevant bits to include here. I followed all the instructions. When I go to my local project site, I get TypeError at /graphql/ __init__() missing 1 required positional argument: 'get_response' Here is the relevant snippet of my settings.py: MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', ] GRAPHENE = { 'SCHEMA': 'hackernews.schema.schema', 'MIDDLEWARE': ['graphql_jwt.middleware.JSONWebTokenMiddleware', ], } AUTHENTICATION_BACKENDS = [ 'graphql_jwt.backends.JSONWebTokenBackend', 'django.contrib.auth.backends.ModelBackend', ] I also did import graphql_jwt in my main schema.py Here is some kind of stack trace Environment: Request Method: GET Request URL: http://localhost:8000/graphql/ Django Version: 2.1.4 … -
Why does the hard-coded url work but not the name-spaced url in Django?
I need someone that really knows their Django. So I can always give more detail if it's necessary but long story short, I'm trying to link to urls using django's url tag and I get a NoReverseMatch exception everytime. <ul> {% for item in results %} <li><a href="{% url 'cards:stats' item.title %}">{{ item.title }}</a></li> {% endfor %} </ul> BUT, when I use the hardcoded url, this works perfectly fine: <ul> {% for item in results %} <li><a href="/cards/stats/{{ item.title }}">{{ item.title }}</a></li> {% endfor %} </ul> Does anyone have any idea why this might be happening? Let me know if you need more details. Any help is appreciated, thanks! -
ManyToMany Field on Django Admin Interface
On Django Rest, I have a many to many relation for a field of material list. Instances of materials are added in a loan model. It works, to add through the admin site but the display is disintuitive: Instances are mixed with materials (instances are in parenthesis). It's possible to have to separated list ? One to select materials and one other to add/remove instances linked to materials ? -
Python MultiValueDictKeyError, Why am getting this Error? Whats the mistake I can't find out. Please help me with this
Product Update Form( product_update.html ) {% extends 'dash_board/products/products_home.html' %} {% load crispy_forms_tags %} {% block update %} <div class="row justify-content-center"> <div class="col-8"> <div class="card"> <div class="card-body"> <h2>Product Update Form:</h2> <!-- When This Product match to any existing Product --> {% if product_match.status %} <h5 style="color: red; border: 1.5px solid red; border-radius: 15px;" class="text-center ml-2 mr-2 p-2"> {{ product_match.message }}</h5> {% endif %} <form method="post" autocomplete="on"> {% csrf_token %} <div class="form-row ml-5 mr-5" enctype="multipart/form-data"> <div class="form-group col-lg-5 "> <!-- Previous | Product Image --> <img id="prev_image" class="float-left float-top rounded img-thumbnail" style="width: 28rem; height: 16rem;" src="{{ product_data.imageReference }}" alt="" /> <br> <!-- Input | Product Image --> <input name="uploaded_image" type='file' class="pt-1 pl-2" /> </div> <div class="form-group col-lg-7 pl-5 pr-5"> <!-- Fixed ID | Barcode --> <p>Barcode: <b><span style="color: deeppink;"> {{ barcode }}</span></b></p> <!-- Input | Product name --> <div style="width: 100%;"> {{ form.itemName|as_crispy_field }} </div><br> <!-- Input | Dropdown | Category --> <select style="width: 100%; height: 2.5em; border-radius: 5px; padding-left:5%; background-color: whitesmoke;" name="product_category" id="input_category"> {% for category in product_data.category_list %} {% if category == product_data.category %} <option class="pl-5" selected="selected" value="{{ category }}"> <b>{{ category }}</b></option> {% else %} <option class="pl-5" value="{{ category }}"> <b>{{ category }}</b></option> {% endif %} {% endfor %} … -
Django: function with model query is being called before migrations
I'm getting an error message saying that "no such table: otree_roomstest" when I'm trying to run my migrations. From what I can tell theres a function being called BEFORE the migrations, when the model is not created yet. Can't really figure out what to change to make the migrations run first then the model query. Hoping someone has a good idea. I've tried putting an if statement around the def get_room_dict() that looks if the model exists, but that did not work. I know the code is long and out of context, I'm just really hoping someone spots a solution, I'm out of ideas. The error message from my terminal Traceback (most recent call last): File "c:\users\perni\projects\otree-core\env\lib\site-packages\django\db\backends\utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "c:\users\perni\projects\otree-core\env\lib\site-packages\django\db\backends\sqlite3\base.py", line 383, in execute return Database.Cursor.execute(self, query, params) sqlite3.OperationalError: no such table: otree_roomstest The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Users\perni\Projects\otree-core\env\Scripts\otree-script.py", line 11, in <module> load_entry_point('otree', 'console_scripts', 'otree')() File "c:\users\perni\projects\otree-core\otree_startup\__init__.py", line 185, in execute_from_command_line fetch_command(subcommand).run_from_argv(argv) File "c:\users\perni\projects\otree-core\env\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv self.execute(*args, **cmd_options) File "c:\users\perni\projects\otree-core\env\lib\site-packages\django\core\management\base.py", line 361, in execute self.check() File "c:\users\perni\projects\otree-core\env\lib\site-packages\django\core\management\base.py", line 390, in check include_deployment_checks=include_deployment_checks, File "c:\users\perni\projects\otree-core\env\lib\site-packages\django\core\management\commands\migrate.py", line 65, in _run_checks issues.extend(super()._run_checks(**kwargs)) … -
Connect to a websocket in a Django ASGI application
I want to run my Django application as usual but at the same time also connect to a websocket and receive events from there that feed into my main Django code. How would I go about doing that? -
Store API response in PostgreSQL
I'm trying to store the response from an API as a field in my postgreSQL table. I receive the data I'm trying to save like this { "count": 0, "next": null, "previous": null, "results": [ { "slug": "slug", "name": "name", "other": [] "things": "string" }, { etc... } } I'm trying to save the results key and everything contained in the corresponding list. Initially I thought I could do search_results = ArrayField(models.CharField(null=True, blank=True), size=3, null=True) but this seems to make it difficult to actually access the information from the keys since it's saving the entries as plain strings. I'm looking for the best way to go about this. Thanks! -
Using npm and Django together?
I developed the frontend using React JS, and I'm having issues with gluing those separate JS and npm modules to my Django backend. Are there any good libraries tackling this issue, or best practices? I'd like to keep the frontend separated from Django. -
Django URL does not see the link and its POST request
I made a project, but in it you need to get a special token from the VK social network. I made the token pass along with the link. She looks like this: http://127.0.0.1:8000/vk/auth#access_token=7138dcd74f5da5e557943b955bbfbd9a62811da7874067e5fa0edef1ca8680216755be16&expires_in=86400&user_id=397697636 But the problem is that the django cannot see this link. I tried to look at it in a post request, get request, but everything is empty there. I tried to make it come not as a request but as a link, it is like this: http://127.0.0.1:8000/vk/auth #access_token=7138dcd74f5da5e557943b955bbfbd9a62811da7874067e5fa0edef1ca8680216755be16&expires_in=86400&user_id=397697636 But the django does not want to read the space. Who can help -
How do you correctly mock a 3rd-party module in Django
I'm trying to write a simple unit test to test an instance method of one of my models in Django. However my class initialises an external connection on __init__ which is not being patched even though I'm trying to target it. Folder Structure: - project/ - app1/ - tests/ - tests_models.py - models.py models.py: from 3rdPartyPlugin import Bot class MyClass: def __init__(self, token): self.bot = Bot(token) def generate_buttons(self): ... tests_models.py: from django.test import TestCase from unittest.mock import MagicMock, patch from app1.models import MyClass @patch('app1.models.3rdPartyPlugin.Bot') class GenerateButtonsTestCase(TestCase): def setUp(self): self.tb = MyClass('', '', '') def test_generates_button_correctly(self): return True I can't get past the setUp step because the initialisation of the class fails because it tries to reach out to that 3rdPartyPlugin module even though I patched it. I've tried setting the patch to: @patch('app1.models.3rdPartyPlugin.Bot') @patch('app1.models.Bot') @patch('app1.models.TB.Bot') But all of the above still leads to the Bot being called. Any suggestions? -
STORE_ENGINE Error deploying Django App to Heroku
I am receiving a mysterious error when trying to deploy my django + react.js app to heroku. AttributeError: 'Settings' object has no attribute 'STORE_ENGINE' and also logger.error(f'StoreEngineFailure KNOX_STORE_ENGINE={settings.STORE_ENGINE} I can not find any reference to adding a 'STORE_ENGINE' setting to settings.py in any related documentation or other questions on this site. I am using djangorestframework==3.11.0 knox==0.0.23 gunicorn==20.0.4 whitenoise==5.1.0 django-heroku django_rest_knox==4.1.0 here is my settings.py import os from corsheaders.defaults import default_headers import django_heroku # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '92(sb@talx3&(5d)@u6x0qxxf*gs2(i-b&g*d_3)fb4xvcb91v' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True # Add current https url here and to facebook api for authentication ALLOWED_HOSTS = ['127.0.0.1', 'localhost', 'easysocialads.herokuapp.com'] # Application definition INSTALLED_APPS = [ 'facebook_ads.apps.FacebookAdsConfig', 'pages.apps.PagesConfig', 'frontend.apps.FrontendConfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', #Django Rest Framework 'rest_framework', #Social Auth 'social_django', #Rest Social Auth 'rest_social_auth', #React Frontend App #Auth 'knox', 'accounts', 'corsheaders', ] REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ('knox.auth.TokenAuthentication',) } MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'corsheaders.middleware.CorsMiddleware', #Social Auth 'social_django.middleware.SocialAuthExceptionMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', ] ROOT_URLCONF = 'easysocialads.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [ #Backend Route #os.path.join(BASE_DIR, … -
How can I use the 'uwsgi_params' file?
I've completed a tutorial on how to set up an nginx-uwsgi-django server. Part of the tutorial was to put a copy of uwsgi_params from the nginx github onto my server. Then, to use that file in the server configuration: server { ... location / { uwsgi_pass django; include /path/to/your/mysite/uwsgi_params; # the uwsgi_params file you installed } } The only explanation it gives for the file is: What is the uwsgi_params file? It’s convenience, nothing more! For your reading pleasure, the contents of the file as of uWSGI 1.3: I'd like a more detailed explanation on the importance of this file. How is this a convenience for me? Am I meant to use them as environmental variables somehow? If so, could you please give a simple use case example? -
dj-rest-auth error when restarting server
I'm using https://dj-rest-auth.readthedocs.io/en/latest/index.html. It works the first time (just after the installation and adding everything), but when I restart VS Code, I can't run the server again. Here is what I get: Exception ignored in thread started by: <function check_errors.<locals>.wrapper at 0x034DA268> Traceback (most recent call last): File "D:\Library\Logiciels\Python\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper fn(*args, **kwargs) File "D:\Library\Logiciels\Python\lib\site-packages\django\core\management\commands\runserver.py", line 112, in inner_run autoreload.raise_last_exception() File "D:\Library\Logiciels\Python\lib\site-packages\django\utils\autoreload.py", line 248, in raise_last_exception raise _exception[2] File "D:\Library\Logiciels\Python\lib\site-packages\django\core\management\__init__.py", line 327, in execute autoreload.check_errors(django.setup)() File "D:\Library\Logiciels\Python\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper fn(*args, **kwargs) File "D:\Library\Logiciels\Python\lib\site-packages\django\__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "D:\Library\Logiciels\Python\lib\site-packages\django\apps\registry.py", line 89, in populate app_config = AppConfig.create(entry) File "D:\Library\Logiciels\Python\lib\site-packages\django\apps\config.py", line 90, in create module = import_module(entry) File "D:\Library\Logiciels\Python\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked ModuleNotFoundError: No module named 'dj_rest_auth' settings.py: INSTALLED_APPS = [ ... 'django.contrib.sites', # 3rd party 'rest_framework', 'rest_framework.authtoken', 'dj_rest_auth', 'allauth', 'allauth.account', 'allauth.socialaccount', 'dj_rest_auth.registration', 'corsheaders', ... REST_SESSION_LOGIN = True EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' SITE_ID = 1 ACCOUNT_EMAIL_REQUIRED = False ACCOUNT_AUTHENTICATION_METHOD = 'username' ACCOUNT_EMAIL_VERIFICATION = 'none' REST_USE_JWT = True JWT_AUTH_COOKIE = 'auth' REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework.authentication.SessionAuthentication', 'rest_framework.authentication.TokenAuthentication', 'dj_rest_auth.utils.JWTCookieAuthentication' ), 'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema' } … -
Replace existing file after uploading a new file
I have a scenario where , I have a svg in my Static Images folder which i am using to display a image on a webpage Now I want if i upload a new svg using <input type="file"> It will replace that existing svg Need some suggestions Thanks in advance -
"[HMR] Waiting for update signal from WDS.. : react console
I am new to react and using React + Django to create a todo app, When I try to console.log anything it gives me this error in the console [HMR] Waiting for update signal from WDS.. I tried to look online, but nothing works. this is the error on my page -
How would I print a model fields from oldest to newest?
I've created a budget app that lists your income and expenses. And instead of listing most recent evemts at the top it lists them in the bottom. Is there anyway I could reverse the list or sort by most recent? Here are some of my folders and my django project. Let me know if I need to add any others, I'm a beginner. HTML file Views Models Django Project, as you can see the most recent are at the bottom -
Django==3.0.7 FileNotFoundError
I know that no is the best way. But I want to know why not find the file. The path is ok. I dont understand that. My views.py and urls.py: The archives path: -
formset for OneToOne fields
I have three models in my Django app: class Parent (models.Model): pass class Sister(models.Model): pass class Brother(models.Model): owner = models.ForeignKey(to=Parent, on_delete=models.CASCADE) sibling = models.OneToOneField(to=Sister, on_delete=models.CASCADE) I need to let users choose for which Sister instances they want to create a corresponding Brother when I create a new Parent (Sisters as you can see are not connected to a Parent). The way I see it that when a user in a ParentCreateView I would also show them the list of all existing Sisters where they can put checkboxes in front of those for whom they would create a corresponding Brother. Then when they submit, a new Parent is created and corresponding number of Brothers attached to the sisters that have been chosen, and to a Parent that just has been created. I can't figure out though the right design: should I use inlineformsetfactory for that? Should I pass there existing sisters? Or I can just pass a checkbox field with existing sisters to a form where new Parent is created, and then create corresponding brothers in a post method of CreateView class. -
Serializing and Deserialzing User using Djoser Django Rest
I am quiet new to django and i am using djoser to create a user. I have custom user Model and Custom User Serializer. My Custom User is following. class User(AbstractBaseUser, PermissionsMixin): """ A fully featured User model with admin-compliant permissions that uses a full-length email field as the username. Email and password are required. Other fields are optional. """ email = models.EmailField(_('email address'), max_length=254, unique=True) first_name = models.CharField(_('first name'), max_length=30, blank=True) middle_name = models.CharField(_('middle name'), max_length=30, blank=True) last_name = models.CharField(_('last name'), max_length=30, blank=True) is_staff = models.BooleanField(_('staff status'), default=False, help_text=_('Designates whether the user can log into this admin ' 'site.')) is_active = models.BooleanField(_('active'), default=True, help_text=_('Designates whether this user should be treated as ' 'active. Unselect this instead of deleting accounts.')) extra_field = models.BooleanField(_('changethis'), default=False, help_text=_('Describes whether the user is changethis ' 'site.')) date_joined = models.DateTimeField(_('date joined'), default=timezone.now) username = models.CharField(_('username'), max_length=30, blank=True) roles = models.ManyToManyField(Role, related_name='role_user') objects = CustomUserManager() and following is my CustomUserManager() class CustomUserManager(BaseUserManager): def _create_user(self, email, password, is_staff, is_superuser, **extra_fields): now = timezone.now() if not email: raise ValueError('The given email must be set') email = self.normalize_email(email) user = self.model(email=email, is_staff=is_staff, is_active=True, is_superuser=is_superuser, last_login=now, date_joined=now, **extra_fields) user.set_password(password) user.save(using=self._db) return user def create_user(self, email, password=None, **extra_fields): return self._create_user(email, password, … -
Django rest. image url sends to html page but not to the image location
Have a picture upload in django rest app. The url is created and looks fine image related code is: Setting.py STATIC_URL = '/static/' STATICFILES_DIRS = ( os.path.join(BASE_DIR, "static"),) MEDIA_URL = "/media/" MEDIA_ROOT = "uploads" URL from django.conf.urls.static import static from django.conf import settings if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) when click on the url the web browser shows nothing- just white(instead of picture). Inspected the page. It sends me not to the image but to the index.html file where I mounted my app: {% load render_bundle from webpack_loader %} <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Combinator optimizer</title> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> <link href="https://fonts.googleapis.com/css2?family=Playfair+Display&display=swap" rel="stylesheet"> {% render_bundle 'app' %} -
Weird error with - python manage.py runserver (Exception in thread django-main-thread)
I am new to Python (to programming, generally), and I hit a brick wall: I am learning from Python Crash Course and I am cloning lessons. The third project in the book deals with Django. It says how you can create a website for keeping logs. I am creating, in parallel, another site, following the same exact instructions. I got through alright until I got to the point where, trying to run my own project, I cannot run the server with python manage.py runserver. when I run this for the original project, it works perfectly. When I stop the server (Ctrl+c) and run the command for my project, I get an error. before I edited certain files, .py files, that is, the command worked for my project, also. I didn't install or uninstall anything. I traced back and reversed every change I've made since the last time the command worked, but I couldn't get rid of the error. I am working with Python 3.8.3 IDE: PyCharm I have Django 3.0.7 I work in totally separated folders, I run everything in virtual environment (which I start using the command venv\Scripts\activate OS: Windows 10 Now, for the project where the runserver command … -
Django: queriying models not related with FK
I'm developping a Django project. I need to make many queries with the following pattern: I have two models, not related by a FK, but that can be related by some fields (not their PKs) I need to query the first model, and annotate it with results from the second model, joined by that field that is not de PK. I can do it with a Subquery and an OuterRef function. M2_queryset = M2.objects.filter(f1 = OuterRef('f2')) M1.objects.annotate(b_f3 = Subquery(M2_queryset.values('f3'))) But if I need to annotate two fields, I need to do this: M2_queryset = M2.objects.filter(f1 = OuterRef('f2')) M1.objects.annotate(b_f3 = Subquery(M2_queryset.values('f3'))).annotate(b_f4 = Subquery(M2_queryset.values('f4'))) It's very inneficient because of the two identical subqueries. It would be very interesting doing something like this: M2_queryset = M2.objects.filter(f1 = OuterRef('f2')) M1.objects.annotate(b_f3, b_f4 = Subquery(M2_queryset.values('f3','f4'))) or more interesting something like this and avoiding subqueries: M1.objects.join(M2 on M2.f1 = M1.f2)... -
Formulas for Optimizing Celery Configurations
I'm trying to figure out celery, and most of the configurations I've landed on have been from guesswork and monitoring jobs/performance after I update settings. A couple of interesting observations - I have continued to see a redis error ConnectionError('max number of clients reached',). It has happened when I have added more periodic tasks. The confusing part about this is my redis plan has a max of 40 connections. In my django app I configured celery to allow for 20 as the max amount of redis connections. Some of the configurations can be found below. CELERY_REDIS_MAX_CONNECTIONS = 20 CELERY_RESULT_EXTENDED = True CELERY_BROKER_TRANSPORT_OPTIONS = { "fanout_prefix": True, "fanout_patterns": True, "max_connections": 10, "socket_keepalive": True, } I finally upgraded Celery, Redis, and Celery Beat, and removed the above configurations. I have not seen the same issue since. celery-redbeat==0.13.0 --> celery-redbeat==1.0.0 celery==4.3.0 --> celery==4.4.4 redis==3.3.11 --> redis==3.5.3 So after this upgrade my connection errors have gone away for now. I notice in my redis instance that the number of connections has almost halved from a daily average of 39, to 24. The next error I tackle is r14 errors where I'm going over my memory limit. I fix this by setting --concurency=4 It was … -
Django makemessages “struct.error: unpack requires a buffer of 4 bytes”- python manage.py runserver 0.0.0.0:8000
Watching for file changes with StatReloader Exception in thread django-main-thread: Traceback (most recent call last): File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/usr/lib/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "/home/vagrant/env/lib/python3.6/site-packages/django/utils/autoreload.py", line 53, in wrapper fn(*args, **kwargs) File "/home/vagrant/env/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run autoreload.raise_last_exception() File "/home/vagrant/env/lib/python3.6/site-packages/django/utils/autoreload.py", line 76, in raise_last_exception raise _exception[1] File "/home/vagrant/env/lib/python3.6/site-packages/django/core/management/__init__.py", line 357, in execute autoreload.check_errors(django.setup)() File "/home/vagrant/env/lib/python3.6/site-packages/django/utils/autoreload.py", line 53, in wrapper fn(*args, **kwargs) File "/home/vagrant/env/lib/python3.6/site-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/home/vagrant/env/lib/python3.6/site-packages/django/apps/registry.py", line 114, in populate app_config.import_models() File "/home/vagrant/env/lib/python3.6/site-packages/django/apps/config.py", line 211, in import_models self.models_module = import_module(models_module_name) File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 994, in _gcd_import File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 665, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/home/vagrant/env/lib/python3.6/site-packages/django/contrib/auth/models.py", line 91, in <module> class Group(models.Model): File "/home/vagrant/env/lib/python3.6/site-packages/django/db/models/base.py", line 160, in __new__ new_class.add_to_class(obj_name, obj) File "/home/vagrant/env/lib/python3.6/site-packages/django/db/models/base.py", line 325, in add_to_class value.contribute_to_class(cls, name) File "/home/vagrant/env/lib/python3.6/site-packages/django/db/models/fields/related.py", line 1585, in contribute_to_class self.remote_field.through = create_many_to_many_intermediary_model(self, cls) File "/home/vagrant/env/lib/python3.6/site-packages/django/db/models/fields/related.py", line 1066, in create_many_to_many_intermediary_model 'verbose_name': _('%(from)s-%(to)s relationship') % {'from': from_, 'to': to}, File "/home/vagrant/env/lib/python3.6/site-packages/django/utils/functional.py", line 160, in __mod__ return str(self) % …