Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
in Django, I use sweetalert2
I have used sweetalert2 to pop up messages, it works great when page return render but when I used return redirect not works there is something I need to add it. any helps Thanks I want a sweetalert2 to pop up when the user submit forms in Django views messages.success(request, 'yes') return render(request, 'app/home.html') Not pop up messages.success(request, 'yes') return redirect('app:home') in html page {% for message in messages %} <script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script> {% if message.tags == 'success' %} <script> Swal.fire( 'good', '{{message}}', 'success' ) </script> {% endif %} {% endfor %} -
How to upload multiple images to a django product model using DRF
Currently I am able to upload only 1 image per product. My Model class Product(models.Model): user = models.ForeignKey(User, on_delete=models.SET_NULL, null=True) name = models.CharField(max_length=200, null=True, blank=True) image = models.ImageField(null=True, blank=True, default='/placeholder.png') brand = models.CharField(max_length=200, null=True, blank=True) category = models.CharField(max_length=200, null=True, blank=True) description = models.TextField(null=True, blank=True) rating = models.DecimalField( max_digits=7, decimal_places=2, null=True, blank=True) numReviews = models.IntegerField(null=True, blank=True, default=0) price = models.DecimalField( max_digits=7, decimal_places=2, null=True, blank=True) countInStock = models.IntegerField(null=True, blank=True, default=0) createdAt = models.DateTimeField(auto_now_add=True) _id = models.AutoField(primary_key=True, editable=False) This is my serializer class ProductSerializer(serializers.ModelSerializer): reviews = serializers.SerializerMethodField(read_only=True) class Meta: model = Product fields = '__all__' def get_reviews(self, obj): reviews = obj.review_set.all() serializer = ReviewSerializer(reviews, many=True) return serializer.data This is the views file @api_view(['GET']) def getProduct(request, pk): product = Product.objects.get(_id=pk) serializer = ProductSerializer(product, many=False) return Response(serializer.data) I am trying to also upload the images to a folder which has same product name if possible. -
Implement hmset in python with dictionary of list and nested dictionary
I was trying to implement below redis code into python django application hmset test_template:TEMPLATE_ID test_tags "[{\"key\":\"test_manual_entry_1\",\"value\":\"Some_value_1\"},{\"key\":\"test_manual_entry_2\",\"value\":\"Some_value_2\"}]" I have tried hset and hmset functions but both are giving the error. Below is sample of my code looks like this class RedisUtil: def hset(self, key_name, data): key_name = "test_template:TEMPLATE_ID" list_data = [{"key": "test_manual_entry_1", "value": "Some_value1"}, {"key": "test_manual_entry_2", "value": "Some_value2"}] data = {"test_tags": [json.dumps(d) for d in list_data]} # output list: ['{"key": "test_manual_entry_1", "value": "Some_value1"}', '{"key": "test_manual_entry_2", "value": "Some_value2"}'] I have tried below methods to save but all methods are giving me error # Method 1 self.redis_client.hset(key_name, data) # Exception: redis.exceptions.DataError: Invalid input of type: 'dict'. Convert to a bytes, string, int or float first. #Method 2 self.redis_client.hset(key_name, "test_tag", data["test_tags"]) # Exception: redis.exceptions.DataError: Invalid input of type: 'list'. Convert to a bytes, string, int or float first. Also, I would like add there that there may be case where my list will be empty, this could be an edge case. Thanks in advance for any help. -
How to add new site language in Django admin
I work on a project where we want to have multilingual site. We start with two languages defined in settings.py LANGUAGES = ( ("en-us", _("United States")), ("cs", _("Czech Republic")), ) Could someone tell me how we can control ( add or remove or disable ) languages from Django admin? I checked these but did not find the answer Adding new site language in Django admin How to manage system languages from django admin site? https://djangowaves.com/tutorial/multiple-languages-in-Django/ -
Page 404 error on clicking at the image link in django admins site
We have a django project in which we are storing images in the backend using image field.The image link is being stored on django admin site.However ,when I click on the link ,I get an error page.Here's my code. models.py images=models.ImageField(upload_to=upload_to,null=True) def upload_to(instance, filename): return 'images/{filename}'.format(filename=filename) urls.py urlpatterns = [ path('admin/', admin.site.urls), path('app/',include('firstapp.urls')), path('',include('firstapp.api.urls')), ]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) settings.py MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'media') # URL used to access the media MEDIA_URL = '/media/' I have created a folder named media but the images are not being stored there.Please help. -
Django template tag URL is not working in JavaScript
I want to add an edit button and delete image dynamically to table, but it is showing error Page Not Found at Request URL: http://127.0.0.1:8000/%7B%25%20url%20'expense-edit'%20expense.id%20%25%7D here is js file const searchField = document.querySelector("#searchField"); const tableOutput = document.querySelector(".table-output"); const appTable = document.querySelector(".app-table"); const paginationContainer = document.querySelector(".pagination-container"); tableOutput.style.display = 'none'; const noResults = document.querySelector(".no-results"); const tbody = document.querySelector(".table-body"); searchField.addEventListener('keyup', (e) => { const searchValue = e.target.value; if (searchValue.trim().length > 0) { paginationContainer.style.display = "none"; tbody.innerHTML = ""; fetch("http://127.0.0.1:8000/search-expenses", { body: JSON.stringify({ searchText: searchValue }), method: "POST", }) .then((res) => res.json()) .then((data) => { console.log("data", data); appTable.style.display = "none"; tableOutput.style.display = "block"; console.log("data.length", data.length); if (data.length === 0) { noResults.style.display = "block"; tableOutput.style.display = "none"; } else { noResults.style.display = "none"; data.forEach((item) => { tbody.innerHTML += ` <tr> <td>${item.amount}</td> <td>${item.category}</td> <td>${item.description}</td> <td>${item.date}</td> <td><a href="{% url 'expense-edit' expense.id %}" class="btn btn-secondary btn-sm">Edit</a><a href="{% url 'expense-delete' expense.id %}"><img src="{% static 'img/delete.png' %}" width="35" height="35"/></a></td> </tr>`; }); } }); } else { noResults.style.display = "none"; tableOutput.style.display = "none"; appTable.style.display = "block"; paginationContainer.style.display = "block"; } }); urls.py from django.urls import path from . import views from django.views.decorators.csrf import csrf_exempt urlpatterns = [ path('', views.home, name="home"), path('expenses', views.index, name='expenses'), path('add-expenses', views.add_expenses, name='add-expenses'), path('edit-expense/<int:id>', views.expense_edit, name='expense-edit'), path('expense-delete/<int:id>', views.delete_expense, … -
How to using order_by with custom function in model
In model MemberProduct I have a function get_member_rating where User can rating for the of their product So in views, I want to sort product ratings of that User by using the function in MemberProduct or any way can do the queryset then order_by member_rating. MemberProduct model class MemberProduct(TimeStampedModel): member = models.ForeignKey( "accounts.Member", related_name="member_product", on_delete=models.CASCADE, ) product = models.ForeignKey( Product, related_name="member_product", on_delete=models.CASCADE ) <some other fields> class Meta: unique_together = ( "member", "product", ) def get_member_rating(self): try: vote = Vote.objects.get(member=self.member, product=self.product) except Vote.DoesNotExist: return None else: return vote.rating Vote model class Vote(models.Model): rating = models.FloatField( validators=[MinValueValidator(0), MaxValueValidator(10)] ) product = models.ForeignKey( Product, related_name="votes", on_delete=models.CASCADE ) member = models.ForeignKey("accounts.Member", on_delete=models.CASCADE) class Meta: unique_together = ["product", "member"] -
django.urls.exceptions.NoReverseMatch | Django is working fine until I created custom signup page. In that specific page, django raises url tag error
I'm building my custom signup page using built-in django authentication. For some reason, my navbar is raising error that it can't read <li><a href="{% url 'jobs:job_list' %}">Browse Job</a></li> and that NoReverseMatch, knowingly that django only throws this error on that particular signup page. Other pages, this url tag is being read by django and it is working completely fine. I tried to delete the HTML page, nothing working. I'm looking for a solution in which my signup page get rendered successfully without being stopped by the NoReverseMatch error while reading my navbar url tag successfully. <li><a href="{% url 'jobs:job_list' %}">Browse Job</a></li> -
Update multiple Postgres timestamps
I am attempting to update timestamps for 100s of objects in Postgres 12 using the following query: UPDATE foo_bar AS c SET created_at = c2.created_at FROM (VALUES (101, '2021-09-27 14:54:00.0+00'), (153, '2021-06-02 14:54:00.0+00') ) as c2(id, created_at) WHERE c.id = c2.id; Where created_at represents a dateTimeField: created_at = models.DateTimeField(auto_now_add=True) I am receiving the following error: ERROR: column "created_at" is of type timestamp with time zone but expression is of type text I have tried many variations of the created_at values to no avail. Any idea why this is not working? -
How do you use v-for and/or v-if to show objects from a Django Postgres backend?
I'm trying to build something like a hierarchy tree in Vue3 that is pulling data from a Django Postgres backend. I've setup all of the models and have it all displaying in the frontend using Django Rest and Axios. The problem is it's showing everything in every branch of my hierarchy tree instead of just the "children" of that branch because I can't figure out how to filter it based on the foreign keys of my Django models. Basically, in the tree I have 4 Grandparents, each with 2 Parents under them, each with 2 Children under them. So 1 branch of the tree should be 1 Grandparent, then 2 Parents, then each with 2 Children. I can only get it to show each branch with 1 Grandparant with 4 Parents and 16 Children. The models look like this: class Grandparent(models.Model): grandparent_id = models.AutoField(primary_key=True) grandparent_name = models.CharField(max_length=40) class Parent(models.Model): parent_id = models.AutoField(primary_key=True) parent_name = models.CharField(max_length=40) grandparent_id = models.ForeignKey(Grandparent, on_delete=models.CASCADE) class Child(models.Model): child_id = models.AutoField(primary_key=True) child_name = models.CharField(max_length=40) parent_id = models.ForeignKey(Parent, on_delete=models.CASCADE) The hopefully relevant parts from my vue file look like this: created () { this.getGrandparents(), this.getParents(), this.getChildren(), }, data () { return { grandparents: [], parents: [], children: [] … -
Copy edx-platform in local system
I applyed bellow cammand but it's not working. docker cp -L edx.devstack.lms:/edx/app/edxapp/edx-platform/ /vscode-platform It gives this error in powershell. symlink ....\common\static\common c:\users\gautamrathore\desktop\vscode-platform\edx-platform\cms\static\common: a required privilege is not held by the client. I want to copy edx-platform in local system. -
Exception in thread django-main-thread Traceback
I am getting this error while trying to run a Django project. This happened when I cloned the project and run it for this first time, I am running it using a virtual environment (env1) C:\Users\Chiam\Desktop\fyp\odyera>python manage.py runserver Watching for file changes with StatReloader Performing system checks... Exception in thread django-main-thread: Traceback (most recent call last): File "C:\Users\Chiam\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 1038, in _bootstrap_inner self.run() File "C:\Users\Chiam\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 975, in run self._target(*self._args, **self._kwargs) File "C:\Users\Chiam\Desktop\fyp\odyera\env1\Lib\site-packages\django\utils\autoreload.py", line 64, in wrapper fn(*args, **kwargs) File "C:\Users\Chiam\Desktop\fyp\odyera\env1\Lib\site-packages\django\core\management\commands\runserver.py", line 134, in inner_run self.check(display_num_errors=True) File "C:\Users\Chiam\Desktop\fyp\odyera\env1\Lib\site-packages\django\core\management\base.py", line 475, in check all_issues = checks.run_checks( ^^^^^^^^^^^^^^^^^^ File "C:\Users\Chiam\Desktop\fyp\odyera\env1\Lib\site-packages\django\core\checks\registry.py", line 88, in run_checks new_errors = check(app_configs=app_configs, databases=databases) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Chiam\Desktop\fyp\odyera\env1\Lib\site-packages\django\core\checks\urls.py", line 42, in check_url_namespaces_unique all_namespaces = _load_all_namespaces(resolver) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Chiam\Desktop\fyp\odyera\env1\Lib\site-packages\django\core\checks\urls.py", line 61, in _load_all_namespaces url_patterns = getattr(resolver, "url_patterns", []) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Chiam\Desktop\fyp\odyera\env1\Lib\site-packages\django\utils\functional.py", line 57, in __get__ res = instance.__dict__[self.name] = self.func(instance) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\Chiam\Desktop\fyp\odyera\env1\Lib\site-packages\django\urls\resolvers.py", line 715, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\Chiam\Desktop\fyp\odyera\env1\Lib\site-packages\django\utils\functional.py", line 57, in __get__ res = instance.__dict__[self.name] = self.func(instance) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\Chiam\Desktop\fyp\odyera\env1\Lib\site-packages\django\urls\resolvers.py", line 708, in urlconf_module return import_module(self.urlconf_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Chiam\AppData\Local\Programs\Python\Python311\Lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Chiam\Desktop\fyp\odyera\client\views.py", line 3, in <module> import pyrebase ModuleNotFoundError: No module named 'pyrebase' Searched a … -
Calculate Business Days in Django Annotate
I wanted to calculate business days in Django annotate. For example, if an event was generated 7 days back, and I wanted to know how many business days had passed. As per the example, 7 days includes [Monday - Sunday], and I only wanted to include [Monday - Friday], which means 5 business days. I've done this logic via some pythonic hack, but I wanted to do this in Django annotate() method. So I can filter the results based on business days. Here is an example of what I've done so far: table_values = Table.objects.all().annotate(issue_severity=datetime.utcnow() - Max("event__created")) for table in table_values: date = datetime.now(timezone.utc) - table.issue_severity dates = (date + timedelta(x + 1) for x in range(table.issue_severity.days)) table.business_days = sum(day.weekday() < 5 for day in dates) -
Where should validation logic go in this DJANGO project
I have an existing python program which verifies coordinates are correct - by that I mean they are in the correct place, not a simple range check. In my Django project I want someone to be able to send these coordinates in, and use my existing code to verify they are correct before saving them to the model. My question is, where does this logic go? Do I put it in the view and reject the HTTP request, if the coordinates are invalid? - this seems simplest to me? Or does this go in the model somewhere, and I prevent invalid coordinates from being saved to the database? I'm new to Django, so not sure what is a good practice / idea. An issue I see with writing a custom validator(?) is these coordinates come in pairs. -
Django pass url context via function
I have a urlpattern in the urls.py file defined as path('profile/<str:uname>/', views.UserProfile, name='UserProfile'), I need to do the following at the return of my function in my views.py file, return render(request, 'UserProfile') How do I pass the 'uname' parameter in this return correctly? P.S. I don't know if this is even possible. -
Prevent people from seeing other user profile pictures
I created a field to allow a user to upload a profile picture. In the template I check if the user is logged in and there is a profile image, otherwise I display a generic one. How can you prevent someone from guessing other filenames to see another users profile picture? {% if user.is_authenticated and user.profile.image %} <span class="avatar avatar-sm" style="background-image: url({{ user.profile.image.url }})"></span> {% else %} <span class="avatar avatar-sm" style="background-image: url('/media/profile_pics/default.png)')"></span> {% endif %} -
Django - Programatically access property of model class (getattr throws Attribute Error)
I am overriding a Model's save method so I can log changes made to certain fields: class Model(models.Model): name = ... price = ... ... __original_name = None __original_price = None def save(self, force_insert=False, force_update=False, *args, **kwargs): for field in [ 'name', 'price', ]: print(self.__original_name) # works original_value = getattr(self, f"__original_{field}") # throws Attribute Error # other logic ... self.__original_name = self.name self.__original_price = self.price super(Model, self).save(force_insert, force_update, *args, **kwargs) Error thrown: AttributeError: 'Model' object has no attribute '__original_name' The method works correctly if I don't loop over the fields and access each field independently with self.__original_field, but I am trying to refactor the code so I can easily start tracking other fields as needed. Is there a different built in method I can use to access the value programatically? (cant use self[f"__original_{field}"] cause it is not subscriptable) -
These are the errors it gives me when I run my project
ModuleNotFoundError: No module named 'portfolio_project.wsgi' raise ImproperlyConfigured( django.core.exceptions.ImproperlyConfigured: WSGI application 'portfolio_project.wsgi.application' could not be loaded; Error importing module This is what I have in my settings: WSGI_APPLICATION = 'portfolio_project.wsgi.application' I'm not sure what to do I tried installing whitenoise and django-cors-headers but that didn't work. -
What is the best way to develop an Elastic Beanstalk Django application locally?
I have recently deployed my Django application on Elastic Beanstalk. I have everything working now, but I'm curious what the best way to develop locally is. Currently, after I make a change locally, I have to commit the changes via git and then run eb deploy. This process takes 1-3 minutes which is not ideal for making changes. The Django application will not run on my local machine, as it is configured for EB. -
Prevent Django health check endpoint logs from being sent to Sentry
I have a Django application with a health check endpoint that's using this repo. In the url_patterns I have added the following line: url(r'^ht/', include('health_check.urls')), The issue is that the health check is filling all the Sentry transaction limits. How can I exclude the health check endpoint in Sentry? -
How to save stripe webhook data to session variables in Django?
I am currently working on a 'success' page for my Django project (which uses Stripe to take payments). I would like to show their order total, with tax, on this page. My Stripe webhook is running and posting data, but for the life of me I can't use this data outside of the webhook's veiw. Normally, when I want to inform one view with data from another, I take advantage of Django's session variables. When I save the session variable, however, attempting to use it in my SuccessView returns 'None' rather than the value saved to it. Any help would be appreciated. Here is my relavent code: views.py def stripe_webhook(request): payload = request.body sig_header = request.META['HTTP_STRIPE_SIGNATURE'] event = None try: event = stripe.Webhook.construct_event( payload, sig_header, settings.STRIPE_WEBHOOK_SECRET ) except ValueError as e: # Invalid payload return HttpResponse(status=400) except stripe.error.SignatureVerificationError as e: # Invalid signature return HttpResponse(status=400) # Handle the checkout.session.completed event if event['type'] == 'checkout.session.completed': session = event['data']['object'] customer_email = session["customer_details"]["email"] line_items = stripe.checkout.Session.list_line_items(session["id"]) print(line_items) stripe_price_id = line_items["data"][0]["price"]["id"] price = Price.objects.get(stripe_price_id=stripe_price_id) total_paid_cents = line_items["data"][0]["amount_total"] total_paid_dollars = total_paid_cents / 100 request.session['total_paid'] = total_paid_dollars return HttpResponse(status=200) class SuccessView(TemplateView): template_name = "musicstudios/success.html" extra_context = sidebar_context def get_context_data(self, **kwargs): context = super(SuccessView, self).get_context_data(**kwargs) order_id = … -
Error running migration after changing to spatialite db
I want to use geographical point in my django app therefor i changed the database engine to spatialite settings.py """ Django settings for server project. Generated by 'django-admin startproject' using Django 4.1.2. For more information on this file, see https://docs.djangoproject.com/en/4.1/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/4.1/ref/settings/ """ from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'django-insecure-+r-63iiele&p+irgsm2ojoayyrk2^6($no8%x+^(32s3wvpk7b' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.admin', 'django.contrib.gis', 'hiketracking.apps.HiketrackingConfig', 'rest_framework', ] 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', ] ROOT_URLCONF = 'server.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'server.wsgi.application' # Database # https://docs.djangoproject.com/en/4.1/ref/settings/#databases DATABASES = { 'default': { "ENGINE": "django.contrib.gis.db.backends.spatialite", 'NAME': BASE_DIR / 'db.sqlite3', }, } # Password validation # https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, … -
time data '2020–04–29 00:00:00' does not match format '%Y-%m-%d %H:%M:%S'
I am getting this error time data '2020–04–29 00:00:00' does not match format '%Y-%m-%d %H:%M:%S' input for start date is '2020–04–29' I am trying to srap tweets using twint and I am geting this error ` config = twint.Config() config.Pandas = True payload = json.dumps(request.GET) payload = json.loads(payload) config.Search = payload.get('keyword') config.Lang = payload.get('language','en') config.Limit = int(payload.get('limit',100)) startDate = payload.get("startDate",None) if startDate: config.Since = startDate endDate = payload.get("endDate",None) print(startDate,endDate) if endDate: config.Until = endDate twint.run.Search(config) ` -
django-filter how to add attribute to html tag under form
I'm using Django-filter,I tried to add attributes by using widget and attrs: filter.py: class MyFilter(django_filters.FilterSet): messageText = django_filters.CharFilter(widget=(attrs={'style':'width: 20px', 'class':'form-select form-select-sm'})) class Meta: model = Mymodel fields = ['messageText '] Then I got: SyntaxError: invalid syntax at here 'attrs={' Any friend can help ? -
Self-hosting multiple sites via one Django project + apache - Django Sites framework
I have a self-hosted (raspberry pi) website running on Django - one project with several apps all serving on one domain name. I'm more of a programmer than a server admin, but it works! Now, I'd like to break one of those apps out onto a second domain name, but still hosting from my pi. --I've looked into a lot of tutorials on how to do this as well as checked out answers like this one but the server-related instructions on everything I've found so far all go a bit over my head or don't seem to match up with my setup. --I've tried the Django Sites framework and I've also followed this tutorial. While I was able to get my site objects in the db, all requests seem just to go to SITE_ID=1, regardless of domain name. I've seen conflicting information here about whether or not SITE_ID should be present in settings.py, but whenever I remove it, I just get errors about it (even though I do have the CurrentSiteMiddleware installed as well as a custom middleware like indicated in that tutorial). Here's what I've got for Django (3.2.14, and py3.7.3), essentially: DjangoApps -mysite --settings.py (allowed_hosts includes mydomain) --urls.py …