Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Is there any method or api method in django rest api to search a list by value instead of key
My list look like this in my model it's a choice list STATUS_CHOICES = [(DELIVERED_STATUS= 'delivered') (FEEDBACK_STATUS='feedback')] DELIVERED_STATUS=1 FEEDBACK_STATUS=2 My endpoint api url is /api/v2/task/list?Status=1 how do i search the content of the list using values of the list instead of their keys for example: /api/v2/task/list?Status=1 to /api/v2/task/list?Status=feedback -
Django Unit Test- How to avoid rollback for each unit test case
I am new to Django framework. I am writing Django unit test cases. The DB transactions are getting roll-backed for each test case. Is it possible to avoid the rollback since I want to use that DB data for other test cases? -
django.db.utils.OperationalError: ERROR: no more connections allowed (max_client_conn)
I have a django app running on kubernetes with postgrsql / pgbouncer I encounter the following error on some requests when I run 2 Django replicas (this doesn't seem to happen if I only set 1 replica) I only have one database Django side django.db.utils.OperationalError: ERROR: no more connections allowed (max_client_conn) PGBouncer side 1 WARNING C-0x55d76aeb6330: (nodb)/(nouser)@xx.xx.xx.xx:37002 pooler error: no more connections allowed (max_client_conn) I have the following settings postgres FROM postgres:12.0 args: - postgres - -c - max_connections=400 SHOW max_connections; max_connections ----------------- 400 (1 row) pgbouncer - name: PGBOUNCER_MAX_CLIENT_CONN value: "800" - name: PGBOUNCER_DEFAULT_POOL_SIZE value: "400" - name: POOL_MODE value: transaction - name: SERVER_RESET_QUERY value: DISCARD ALL I suppose this comes for these settings but cannot figure out what to set. Can someone give me what values would work ? Once fixed and with this architecture (Django + PGBouncer + Postgrsql) could I launch 5/10/15... replicas and the database/bouncer will handle it ? Thanks -
Try to Return dataset as a table with request of postman
I wanna Request with postman and get a table of all books as return but I can't find a way to do this. Thanks a lot This is my model of books: class Book(models.Model): name = models.CharField(max_length=100) username = models.ForeignKey(User, on_delete=models.CASCADE) publication_date = models.DateField() publisher = models.ForeignKey(Publisher, on_delete=models.CASCADE) description = models.TextField() def __str__(self): return self.name And This is my View: class AddBookAPIView(APIView): renderer_classes = [TemplateHTMLRenderer] template_name = 'book.html' @method_decorator(login_required(login_url='login/')) def post(self, request): book_serializer = BookSerializer(data=request.data) if book_serializer.is_valid(): book_serializer.save() return redirect('home') return Response({'message': book_serializer.errors}) @method_decorator(login_required(login_url='login/')) def get(self, request): book = Book() serializer = BookSerializer(book) return Response({'serializer': serializer, 'book': book}) -
Django logs are working fine in my Windows local Environment but not getting logs in live ubuntu server. I am using Nginx with Gunicorn
import logging logging.basicConfig(filename=os.path.join(BASE_DIR, 'django.log'), level=logging.INFO, format='%(asctime)s %(levelname)s %(message)s') ##################### Here is the Middleware ####################### class RequestResponseLoggingMiddleware: def init(self, get_response): self.get_response = get_response def __call__(self, request): response = self.get_response(request) logger.info('Request: {0} {1} {2}'.format(request.method, request.path, get_client_ip())) return response def get_client_ip(): try : hostname = socket.gethostname() IPAddr = socket.gethostbyname(hostname) ip = IPAddr except : ip = '-' return ip Here is what I am getting in my Windows logs 2023-03-09 19:42:33,972 INFO Request: GET /login 192.185.45.22 -
i can't upload files from django admin panel and just still loading
iam using django 3.0.3 and i want to upload files from admin panel but when i try to upload file it still loading and at least it show error 500 request time out , i deploy my website in namecheap so how to fix it settings.py : # media dir MEDIA_URL= '/media/' MEDIA_ROOT = os.path.join('/home/traixmua/public_html/media') urls.py : urlpatterns = [ path('', views.home, name='home'), ]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) handler404 = 'blog_app.views.handler404' models.py : class Trainer(models.Model): document = models.FileField(upload_to='documents/') admin.py : from django.contrib import admin from blog_app.models import Trainer # Register your models here. class TrainerAdmin(admin.ModelAdmin): search_fields = ('name', 'name') admin.site.register(Trainer,TrainerAdmin) what is the problem here i can't find any problem note : when i try to upload files using SQLite on local server not in hosting it's work good but with mysql i have this problem , i can choose the file but it won't to upload -
Filter by time in DRF
I have an api with an end day field (ad end time), in the model, this is a simple datetime field: end_date = DateTimeField(null=True, blank=True) in my view there are several types of filtering for ads, but I need some checkbox that will compare the current date and time with the one written in this field, based on which only relevant ads will be displayed Is there something similar in the DRF, like this(DjangoFilterBackend): class AdAPI(generics.ListAPIView): queryset = Ad.objects.all() serializer_class = AdSerializers filter_backends = [DjangoFilterBackend, filters.OrderingFilter] filterset_class = AdFilterSet I will be grateful for the hint -
how to loop Django SESSION data in Django views.py file
dict_items([('1', {'name': 'Talon Lott', 'image': '/media/images/products/1.png', 'reg_price': '958.0', 'dis_price': '844.0', 'qty': 1}), ('2', {'name': 'Lionel Owens', 'image': '/media/images/products/2.png', 'reg_price': '684.0', 'dis_price': '221.0', 'qty': '1'}), ('3', {'name': 'Brenna Chan', 'image': '/media/images/products/3.png', 'reg_price': '728.0', 'dis_price': '177.0', 'qty': 1}), ('4', {'name': 'Amos Osborne', 'image': '/media/images/products/4.png', 'reg_price': '453.0', 'dis_price': '547.0', 'qty': '1'})]) this data i added to Django session i want to calclute single data: (qty and price ) and i want to claclute my (total amount) But In views.py file when i loop this data i only get id:1 data. {'name': 'Talon Lott', 'image': '/media/images/products/1.png', 'reg_price': '958.0', 'dis_price': '844.0', 'qty': 1} So how may i make a loop for my session data. Here is my views.py file def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) total_amounts = 0 saving = 0 if 'cartdata' in self.request.session: for pro_id, item in self.request.session['cartdata'].items(): total_amounts += int(item['qty']) * float(item['dis_price']) saving += float(item['reg_price']) - float(item['dis_price']) print(item) context={ 'total_amounts': total_amounts, 'saving': saving, 'cart_data': self.request.session['cartdata'], 'totalitems': len(self.request.session['cartdata']) } return context -
Why are path variable keys being read as values in my Django application?
I am using Django Rest Framework to build an api. This is my first time working with DRF, but have experience working with Laravel/NestJs so the concept of routing isn't too unfamiliar. In my DRF application, my url config looks something like this: // urls.py urlpatterns = [ path('api/v1/accounts/<str:account_number>/', accounts.AccountsViewSet.as_view()), url('api/v1/', include(router.urls)), ] In Postman, I am sending a GET request to the following url: {{my_host}}/api/v1/accounts/:account_number/ My view looks like this: // view.py def get(self, request, account_number=None, *args, **kwargs): print(account_number) if account_number is not None: print('account_number was provided') else: print('account_number provided') When sending a GET request to my endpoint, I can provide a value for account_number key. Let's say I use ABC123 as the key value. Given the above view, the first print statement returns ABC123. I will also get into the first if block and see the message account_number was provided All is well! However, if I do not provide an account number (I leave the path variable value empty) I am getting the path variable itself in my logging. For example: // view.py def get(self, request, account_number=None, *args, **kwargs): print(account_number) // :account_number if account_number is not None: print('account_number was provided'). <!-- still getting here else: print('account_number provided') As … -
How do I stop Geolocation from submitting twice?
I am building a crime alert website and I want the user's longitude and latitude to be extracted once the user submits a new alert. Instead, it is submitting twice returing both lat and lng with value and the other without value. I wanted it to return this: lucas posted a crime alert! Alert!!! cv !!! Crime reported from Ogbia, Bayelsa Crime coordinates: Longitude 3.325952 | Latitude 6.599475 Category: c March 9, 2023, 1:53 p.m. Instead, it is submitting twice like this: lucas posted a crime alert! Alert!!! cv !!! Crime reported from Ogbia, Bayelsa Crime coordinates: Longitude 3.325952 | Latitude 6.599475 Category: c March 9, 2023, 1:53 p.m. lucas posted a crime alert! Alert!!! cv !!! Crime reported from Ogbia, Bayelsa Crime coordinates: Longitude None | Latitude None Category: c March 9, 2023, 1:53 p.m. My Views: def new_alert(request): if request.method == "POST": content = request.POST.get("content") state = request.POST.get("state") lga = request.POST.get("lga") category = request.POST.get("category") current_user = request.user lat = request.POST.get("lat") lng = request.POST.get("lng") # Create a new alert new_alert = Alert(content=content, state=state, lga=lga, user=current_user, category=category, latitude=lat, longitude=lng) new_alert.save() return HttpResponseRedirect(reverse("all_alerts")) else: return render(request, "new_alert.html") My Javascript: <script> function getLocation() {`your text` if (navigator.geolocation) { // Display confirmation prompt … -
Configure Django in IIS
How can I configure a Django Project on IIS without wfastcgi.py? I don't found any wfastcgi.py in python's 3.10.10 folder. Anyone could help me? Try to follow some internet tutorials without success. -
axios error in uploading files from react to django rest framework
on react console its showing axios error of bad request i have the tested the backend with postman [working postman test] (https://i.stack.imgur.com/GFMae.png) 1>here is the react axios code const [coloumn, setColoumn] = useState(""); const [selectedFile, setSelectedFile] = useState(null); const handleSubmit = async (event) => { event.preventDefault(); console.log(selectedFile) console.log(coloumn) const response = await axios({ method: "post", url: "http://127.0.0.1:8000/file/upload", file:selectedFile, remark:coloumn, headers: { "Content-Type": "multipart/form-data" }, }); console.log(response) }; 2>here is the django rest framework views code parser_classes = (MultiPartParser, FormParser) def post(self, request, *args, **kwargs): file_serializer = FileSerializer(data=request.data) if file_serializer.is_valid(): file_serializer.save() return Response(file_serializer.data, status=status.HTTP_201_CREATED) else: return Response(file_serializer.errors, status=status.HTTP_400_BAD_REQUEST) I have tried using the axios api with formdata but its not working as well -
Best approach to resolve recursive calls of deferred fields especially mentioned on __str__ method on django
Recently i came across two scenarios where i got recursive calls issue due to deffered fields. I've resolved one and have some ideas on how to resolve the second one but need your opinions on what would be the best approach. I'll start with scenario 1's problem and solution to better understand my actual issue(scenario 2). Scenario # 1 Below are snippets of specific part of my models: class Transaction(BaseModel): STATUS_CHOICES = ( ('1', 'PENDING'), ('2', 'PROCESSING'), ('3', 'APPROVED'), ('4', 'FAILED'), ('5', 'DISMISSED') ) # some unimportant fields account = models.ForeignKey('account_management.Account', on_delete=models.RESTRICT, related_name='transactions') name = models.CharField(max_length=255) user_goal_config = models.ForeignKey('UserGoalConfig', on_delete=models.RESTRICT, related_name='transactions') status = models.CharField(max_length = 1, choices = STATUS_CHOICES, default='1') payment_status = models.CharField(max_length = 1, choices = STATUS_CHOICES, default='1') amc_status = models.CharField(max_length = 1, choices = STATUS_CHOICES, default='1') # some unimportant fields class Meta: db_table = 'transaction' ordering = ['-created_at'] _status = '1' _payment_status = '1' _amc_status ='1' def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # to keep track of old values self._status = self.status self._payment_status = self.payment_status self._amc_status = self.amc_status self._action = self.action def __str__(self) -> str: return f'{self.name} | {self.id} | {self.account}' class UserGoalConfig(BaseModel): name = models.CharField(max_length=150) # some unimportant fields now let's assume that there is one goal(id=1) … -
Error Running Selenium/Django/Firefox. unable to create file '/var/www/.cache/dconf/user': Permission denied. dconf will not work properly
I am running selenium 4.1 with geckodriver 0.32.2 and firefox 110.0.1. The AWS EC2 is on Ubuntu 22.04. I had to install firefox not using snap. Here is the code to get the driver. options = webdriver.FirefoxOptions() options.headless = True if not driver: driver = webdriver.Firefox(executable_path=GeckoDriverManager().install(), options=options) Here is the error in the geckodriver log. 1678369806282 geckodriver INFO Listening on 127.0.0.1:57825 1678369806786 mozrunner::runner INFO Running command: "/bin/firefox" "--marionette" "-headless" "--remote-debugging-port" "50887" "--remote-allow-hosts" "localhost" "-no-remote" "-profile" "/tmp/rust_mozprofileq2trdx" *** You are running in headless mode. [GFX1-]: glxtest: Unable to open a connection to the X server [GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt (firefox:18279): dconf-CRITICAL **: 13:51:06.828: unable to create file '/var/www/.cache/dconf/user': Permission denied. dconf will not work properly. I have given 777 permission to the folder and everything. It then fails in the code for the following stacktrace. Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/django/core/handlers/exception.py", line 34, in inner response = get_response(request) File "/usr/local/lib/python3.10/dist-packages/django/core/handlers/base.py", line 115, in _get_response response = self.process_exception_by_middleware(e, request) File "/usr/local/lib/python3.10/dist-packages/django/core/handlers/base.py", line 113, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/usr/local/lib/python3.10/dist-packages/django/views/decorators/csrf.py", line 54, in wrapped_view return view_func(*args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/django/views/generic/base.py", line 71, in view return self.dispatch(request, *args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/rest_framework/views.py", line 509, in dispatch response = … -
Django-components - Include all js files of all components every time
I designed some components in Django using django-components library. I noticed when I use the {% component_js_dependencies %} tag in pages I use components, it loads all javascript files of every components. Is there a way to load only the javascript files of the components I use in the page ? Thank you all I tried to specify some option but to no avail -
PostgreSQL returns Copy 0 for a csv file
I have a test database with 2 lines that consists of 7 fields integrated with django. Apart from that, I have another test database with an obvious error in it (random delimiters). The query is the following: COPY public.website_manager_tasks FROM 'C:\upwego_test\csvs\tasks.csv' DELIMITER '|' CSV HEADER; The database is the following: No extra spaces, strings have quotation marks, the delimiter is set properly, data types match, the name of the file doesn't match any columns. In the second database, the delimiters are set improperly: ; | | | | | However, the data from this database copies perfectly. I don't understand the postgre's problem here. I have tried changing the resetting the delimiters in the first database so that they matched the pattern in the second database, and it didn't help. I also tried to copy the text from the first database to the second database and everything worked perfectly. I have no idea why it happens so. I'd be glad if anyone could explain this glitch and am ready to provide additional details. -
Django Функция сравнения содержимого http-адреса с именем папки
need help. There are named folders - post-1, post-2, post-3. Images are in folders. There are posts. You need to write a function that will compare the current http address post with the name of the folder and display its contents (all pictures) in the post. If the http address contains post-1 (http looks like this: http://category/post-1 ), then it displays the contents of the folder - post-1 on the page Need a function and a way to display it in the post template. I don't understand how to do it. Please help solve this problem -
Django form, "Value in valid, select not available"
I'm compelety new with python, after watched a vedio on youtube over the weekend I tried to create a Employee Management app with Django. In the video, all feilds are CharFields, after finish it as it was showed in the video, I tried to change some fields to dropdown list. Then it shows error "Value not valid, select not available" in one of the modified field when try to save the form input data. The Error message is that Branch_Name choices are invalid, and select is unavailable. Please check the code below and help me fix it. Many thanks. #in models.py: #in models.py from django.db import models class Bankinfo(models.Model): Bank_Name=models.CharField(max_length=100) Branch_Name=models.CharField(max_length=100) Branch_Sort_Code=models.CharField(max_length=50) def __str__(self): return f'Bankinfo: {self.Bank_Name}{self.Branch_Name}{self.Branch_Sort_Code}' class Employee(models.Model): def get_branch_choices(self): bank = Bankinfo.Bank_Name branches = Bankinfo.objects.filter(Bank_Name=bank).values_list('Branch_Name', 'Branch_Name').distinct() return branches def get_sort_code_choices(self): bank = Bankinfo.Bank_Name branch = Bankinfo.Branch_Name sort_codes = Bankinfo.objects.filter(Bank_Name=bank, Branch_Name=branch).values_list('Branch_Sort_Code', 'Branch_Sort_Code').distinct() return sort_codes def update_branch_choices(self): self.BRANCH_CHOICES = self.get_branch_choices() self.SORT_CODE_CHOICES = self.get_sort_code_choices() self.save() selected_bank = self.Bank_Name selected_branch = self.Branch_Name sort_codes = Bankinfo.objects.filter(Bank_Name=selected_bank, Branch_Name=selected_branch).values_list('Branch_Sort_Code', 'Branch_Sort_Code').all() self.SORT_CODE_CHOICES = sort_codes self.save() bank = Bankinfo.objects.all() BANK_CHOICES = [] bank_names = set() # Use a set to keep track of unique bank names for bk in bank: if isinstance(bk, Bankinfo) and bk.Bank_Name not in … -
change an imbricated list to a flat list in django, python
I want a flat list for my categories list in output, but this code doesn't do that. It still shows the categories in imbricated list. Can someone help me? This is the code: @api_view(['GET']) def AllCategoriesList(request): categories = Categories.objects.filter(parent=None).prefetch_related( Prefetch('children', queryset=Categories.objects.all(), to_attr='subcategories') ) def flatten_list(lst): flat_lst = [] for item in lst: if isinstance(item, list): flat_lst.extend(flatten_list(item)) else: flat_lst.append(item) return flat_lst category_list = [] for category in categories: category_list.append(category) category_list.extend(category.children.all()) flattened_list = flatten_list(category_list) serializer = CategorieSerializer(flattened_list, many=True) return Response(serializer.data) I tried to change my code to use the flatten_list function, but it doesn't work. This is the output: { "id": 1, "image_couverture": null, "children": [{ "id": 2, "image_couverture": null, "children": [], "nom_categorie": "nouveau categorie", "descriptions": "categorie fille", "slug": "nouveau-categorie", "created_at": "2023-03-04T08:08:35.667959Z", "updated_at": null, "parent": 1 } ], "nom_categorie": "Test categorie", "descriptions": "test categorie", "slug": "test-categorie", "created_at": "2023-03-04T06:43:42.628255Z", "updated_at": null, "parent": null }, { "id": 2, "image_couverture": null, "children": [], "nom_categorie": "nouveau categorie", "descriptions": "categorie fille", "slug": "nouveau-categorie", "created_at": "2023-03-04T08:08:35.667959Z", "updated_at": null, "parent": 1 }, { "id": 3, "image_couverture": null, "children": [ { "id": 4, "image_couverture": null, "children": [], "nom_categorie": "Boissons", "descriptions": "Test description", "slug": "boissons", "created_at": "2023-03-06T10:13:39.229660Z", "updated_at": null, "parent": 3 } ], "nom_categorie": "Alimentation & vins", "descriptions": "Test Description", "slug": … -
Minimal Reproducible Example for a django+celery project that can be deployed to google cloud Appengine, using redis on Memorystore
I have been stumped on this for quite a while, to the point where I just need this much help: I have a django + celery project that works fine locally, and I need to have it served on google cloud AppEngine. Having just Django deployed is working, but I cannot for the life of me figure out how to integrate celery. The issues that I need to solve are: get both django and celery to be served as single service have celery use the redis Memorystore instance as broker Having some kind of starting point that 100% works is what I would like to see, in order to study it and adapt it to my needs. It seems that every person that has asked this question didn't receive an satisfactory answer, just "use this other thing" "check the docs (404 link)" etc. I hope someone can point me to the right direction! -
FileNotFoundError at /ml/application/non-citizen-applicant/attest/ [Errno 2] No such file or directory: '/tmp/tmp5p0gvmpz.upload.jpg'
My Django app is a form that collects images and texts fields. It worked perfectly on the local server but when I deployed it on render, it gives the error 'FileNotFoundError at /ml/application/non-citizen-applicant/attest/ [Errno 2] No such file or directory: '/tmp/tmp5p0gvmpz.upload.jpg'' How do I resolve this? Here is my save function for the images def save(self, commit=True): instance = super().save(commit=False) if commit: instance.save() image1 = self.cleaned_data.get('image1') image2 = self.cleaned_data.get('image2') image3 = self.cleaned_data.get('image3') fs = FileSystemStorage() if image1: filename = fs.save(image1.name, image1) instance.image1 = filename if image2: filename = fs.save(image2.name, image2) instance.image2 = filename if image3: filename = fs.save(image3.name, image3) instance.image3 = filename if commit: instance.save() return instance I used postgres for database when deploying on render.com and db.sqlite for local server (https://i.stack.imgur.com/eW4bV.jpg) -
Django sends web requests messages to my logging file
I want to cancel Django to show me those web server requests, it getting to my uwsgi.log file of my application and i can't find where to set it off. enter image description here I tried looking at the documentation of django but couldn't find -
Django I'm trying to comment on posts, but I'm not getting it right
I'm trying to comment on posts, but I'm not getting it right. I have a comment model associated with a post model. We need a separate function for presenting comments on post pages. I tried different options, but nothing works. I wrote functions, but I don’t understand how to display them in a template. Help write a function and how to display a form for adding and displaying comments. class season(models.Model): slug = models.SlugField(max_length=266, unique=True, db_index=True, verbose_name=('SLUG')) ... def __str__(self): return self.slug def get_absolute_url(self): return reverse('seasonpost', kwargs={'seasonpost_slug': self.slug, 'episodepost_slug': self.slug}) class episode(models.Model): slug = models.SlugField(max_length=266, unique=True, db_index=True, verbose_name=('SLUG')) ... cat = models.ForeignKey('season', on_delete=models.PROTECT, null=True) def __str__(self): return self.slug def get_absolute_url(self): return reverse('episodepost', kwargs={'seasonpost_slug': self.slug, 'episodepost_slug': self.slug}) class Comment(models.Model): post = models.ForeignKey(episode,on_delete=models.CASCADE, related_name='comments') name = models.CharField(max_length=80) email = models.EmailField(blank=False) body = models.TextField() created_on = models.DateTimeField(auto_now_add=True) active = models.BooleanField(default=False) class Meta: ordering = ['created_on'] def __str__(self): return 'Comment {} by {}'.format(self.body, self.name) FORMS.PY from .models import Comment from django import forms class CommentForm(forms.ModelForm): class Meta: model = Comment fields = ('name', 'body') Views from .forms import * from .models import * ... def ContentSeason(request, seasonpost_slug): seasonpages = get_list_or_404(season, slug=seasonpost_slug) seasonpages=season.objects.filter(slug=seasonpost_slug) return render(request, 'content/season.html',{ 'season':seasonpages, }) def ContentEpisode(request, seasonpost_slug, episodepost_slug): episodepost = episode.objects.filter(slug=episodepost_slug, … -
Getting A Django Template Syntax Error. How do I solve this?
I tried to extend the base.html file in index.html. But I keep getting the following error: Invalid block tag on line 2: 'endblock'. Did you forget to register or load this tag? base.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>{% block title %}{% endblock %}</title> <!-- {% block css_files %} {% endblock %} --> </head> <body> {% block content %}{% endblock %} </body> </html> index.html {% extends 'base.html' %} {% block title %} My Blog {% endblock %} {% block content %} Hello {% endblock %} I've made sure there are no gaps between any of the curly braces and %. Where could be the issue? -
Django unit test - TEST Mirror default database
I am trying to set up some testing on my Django application. I have used a database mirror for the test database. DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'example1', 'USER': 'root', 'PASSWORD': 'password', 'HOST':'localhost', 'PORT':'3306', 'TEST': { 'MIRROR': 'default', } }, } I added new data to the mirror database when executing test cases. How to view Mirror database and its tables and data from MySQL Workbench? If I want to destroy Test mirror database, how to do that?