Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How yo get Parameters in swagger Post Request Django
I am not able to get request parameter in my post request on swagger . I am using Classes based components in my project . I am using drf_yasg module in my project to integrate swagger . I am not using any database for now in my project . enter image description here -
Cannot get te value from HTML buttons to Django view
Here's my original HTML with the "radio" buttons: <div data-value="attending" class="radio-tempo col-sm-12"> <button class="btn btn-default active" data-value="yes"><i class="fa fa-smile-o"></i>Yes</button> <button class="btn btn-default" data-value="no"><i class="fa fa-frown-o"></i>No</button> </div> I wanted to capture the values into my POST request so I modified it and added names and values to my HTML code: <div data-value="attending" class="radio-tempo col-sm-12"> <button name="button_yes" value="yes" class="btn btn-default active" data-value="yes"><i class="fa fa-smile-o"></i>Yes</button> <button name="button_no" value="no" class="btn btn-default" data-value="no"><i class="fa fa-frown-o"></i>No</button> </div> And the views.py def index(request): if request.method == 'POST': print(request.POST) The output: <QueryDict: {'csrfmiddlewaretoken': ['zSRXL8dUDyWlSMdnHs3qTrNHWOHu3WC9eOWnDuI4wW95VvndDArPlS4vGPFTooDs'], 'FirstName': ['John'], 'LastName': ['Smith'], 'Message': ['bla bla']}> What am I doing wrong? I know that best way would be to use plain radio buttons but I would like to avoid CSS styling of the radio buttons and keep the original HTML template elements. -
Django is_staff flag resets every time user log in
How to set is_staff flag permanently? I have LDAP connected to my Django app. When i set up is_staff flag in admin panel its all ok but when this user relogs it is changed back to no-flag. Is there any way to prevent changing it back and set is_staff flag permanently? -
How i can make a content of a field go to the next line after find a specific caractere or after a certain width
Hi i need some help please am stuck on , I want to generate a pdf (Django application) using xhtml2pdf , I have a field will be fill out by the user that can contain more than 12 words so i want this field in pdf to go in the next line after find the charactere "," or after some words , the important thing that it should'nt be all the words in same line. this is the field in views.py : obj_reports = reports.objects.filter(user=request.user).last() field_obj_project = reports._meta.get_field("project_name") field_value_project = field_obj_project.value_from_object(obj_reports) project_name = str(field_value_project) here is my generate_pdf.html: <p style="font-size: 10px;>{{ project_name }}</p> this is the result: enter image description here any help will be appreciated, if it's posible to do that, How i can make a content go to the next line using html or python after a certain width or if he find a specifc caractere"," . Ps: i have tried: p { word-wrap: break-word; max-width: 250px; } ---> but there is no result -
How to access an element of a model after a join in Django?
My post is similar to this one except I can't access an item : Stackoverflow : How to make an Inner Join in django? I want to display in an Html the locomotive number and the name of the customer who owns this locomotive. But they are in different tables. Here is my models.py class Client(models.Model): client_name = models.CharField(max_length=100, null=False, unique=True) def __str__(self): return self.client_name class Locomotive(models.Model): locomotive_number_id = models.CharField(max_length=50, null=False, unique=True) locomotive_asset_id = models.CharField(max_length=50, null=False, unique=True) locomotive_client = models.ForeignKey(Client, null=False, on_delete=models.CASCADE) def __str__(self): return self.locomotive_number_id Here is my views.py def settings(request): my_clients = Client.objects.values_list('client_name', flat=True) my_locomotives = Locomotive.objects.select_related('locomotive_client') return render(request, 'home/settings.html', context={"my_clients": my_clients,"my_locomotives": my_locomotives}) if I print my_locomotives.query I get this : print(str(my_locomotives.query)) SELECT "foo_bar_locomotive"."id", "foo_bar_locomotive"."locomotive_number_id", "foo_bar_locomotive"."locomotive_asset_id", "foo_bar_locomotive"."locomotive_client_id", "something1_something2_client"."id", "something1_something2_client"."client_name" FROM "foo_bar_locomotive" INNER JOIN "something1_something2_client" ON ("foo_bar_locomotive"."locomotive_client_id" = "something1_something2_client"."id") Here is the html code that allows me to display the list of locomotives. Except that I can't display the name of the customer who owns the locomotive. {% for elements in my_locomotives %} <option value="{{elements}}">{{elements}} - {{elements.client_name}}</option> {% endfor %} How can I do to display this: Locomotive N° 550XXXYYY - CUSTXXXYYY -
How to solve error messsage about django project upload to Heroku. and show "Application error"
I already upload django project to Heroku, But open the website show "Application error". How to solve error messsage about file upload to Heroku. Application Logs: 2022-06-28T09:21:12.444272+00:00 heroku[run.7288]: State changed from up to complete 2022-06-28T09:21:21.415014+00:00 heroku[run.2306]: Awaiting client 2022-06-28T09:21:21.432922+00:00 heroku[run.2306]: Starting process with command `python app2022_text/manage.py createsuperuser` 2022-06-28T09:21:21.495723+00:00 heroku[run.2306]: State changed from starting to up 2022-06-28T09:21:24.891131+00:00 heroku[run.2306]: Process exited with status 2 2022-06-28T09:21:24.949791+00:00 heroku[run.2306]: State changed from up to complete 2022-06-28T09:21:32.374380+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=floating-sea-01052.herokuapp.com request_id=7a80bfac-14a0-41a2-a023-0bb10424eaa5 fwd="101.9.128.18" dyno= connect= service= status=503 bytes= protocol=https 2022-06-28T09:21:32.829611+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=floating-sea-01052.herokuapp.com request_id=e48beeaa-977a-4aae-90a1-9872a0410ff3 fwd="101.9.128.18" dyno= connect= service= status=503 bytes= protocol=https 2022-06-28T09:21:57.549827+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=floating-sea-01052.herokuapp.com request_id=d3fa67ad-0c96-4a80-acc8-5ae5c0bacc1f fwd="101.9.128.18" dyno= connect= service= status=503 bytes= protocol=https 2022-06-28T09:21:58.181777+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=floating-sea-01052.herokuapp.com request_id=9b38aab1-96d6-4730-b782-e77666bf8032 fwd="101.9.128.18" dyno= connect= service= status=503 bytes= protocol=https 2022-06-28T09:21:18.945106+00:00 app[api]: Starting process with command `python app2022_text/manage.py createsuperuser` by user bartha.hsu.design@gmail.com -
django -- can we combine two validators in one method
I want to use just one method to validate the file extention and the file size. is this possible by multiple if ```def validate_file_extension(value): ext = os.path.splitext(value.name)[1] valid_extensions = ['.tar.gz', '.tgz', '.tar', '.gz', 'tar.xz', '.zip'] if not ext in valid_extensions: raise ValidationError(u'File not supported, Please upload only .tar.gz / .tgz / .zip')``` and filesize= value.size if filesize > 10485760: raise ValidationError("The maximum file size that can be uploaded is 10MB") else: return value -
Reverse proxy in Nginx causes "SyntaxError: unexpected EOF while parsing in python"
I know there are a lot of similar questions to my question, and also I know how to fix the error. But I have no idea the reason for the error. ( So, please don't give my question immediately a -1, if you don't have time to read it all ) I changed HTTP to HTTPS in my Nginx, now I am getting the "SyntaxError: unexpected EOF while parsing". However, the code is still working locally with HTTP and HTTPS, and also it was working on the server with HTTP until I changed the proxy from HTTP to HTTPS. Here is my code: if filter_name == "kunde": konzern_qs = Konzern.objects.filter(kunde__name_slug__in=field_input).values_list("name") commitments = commitments.filter(expr_filter) | eval(" | ".join( ["commitments.filter(konzern='{}')".format(k[0]) for k in konzern_qs])) and the error: File "/home/webapps/visoon_backend/venv/lib/python3.6/site-packages/rest_framework/mixins.py", line 38, in list queryset = self.filter_queryset(self.get_queryset()) File "/home/webapps/visoon_backend/visoon_backend/visoon/views.py", line 1353, in get_queryset ["commitments.filter(konzern='{}')".format(k[0]) for k in konzern_qs])) File "<string>", line 0 ^ And this error appears only if konzern_qs = [] but if there is data, it is working. Any idea? why it is only happening on HTTPS with gunicorn and an Nginx, but it is working locally with HTTP and also HTTPS? -
Setting up Online Booking form, getting this error - TypeError at /bookings/ 'OnlineForm' object is not callable
Can anyone please help. I am currently working through a project where I am attempting to create a website for a fictitious restaurant, including an online booking form. I am getting the following error message: TypeError at /bookings/ 'OnlineForm' object is not callable I have watched a number of videos and read through the Django documentation and I still have no idea what I am doing wrong. I am new to Django so this is all learning for me. Any advice you can give would be hugely appreciated. Thank you in advance This is my code: view.py: class BookingForm(FormView): form_class = OnlineForm() args = {} def booking_view(self, request): if request.method == 'POST': form = OnlineForm(request.POST) return render(request, 'bookings.html') models.py OCCASION_CHOICE = ( ('Birthday', 'BIRTHDAY'), ('Anniversary', 'ANNIVERSARY'), ('Graduation', 'GRADUATION'), ('Communion', 'COMMUNION'), ('Confirmation', 'CONFIRMATION'), ('Christening', 'CHRISTENING'), ('Date Night', 'DATE NIGHT'), ) class Booking(models.Model): name = models.CharField(max_length=50) email_address = models.EmailField() phone = models.IntegerField() number_of_people = models.IntegerField(validators=[MinValueValidator(1), MaxValueValidator(10)],default='1', help_text='For parties of more than 10, please call us on 021 4569 782') date = models.DateField() time = models.TimeField() occasion = models.CharField(max_length=100, choices=OCCASION_CHOICE, default='Birthday') def __str__(self): return self.name forms.py: from django.forms import ModelForm from .models import Booking class OnlineForm(ModelForm): class Meta: model = Booking fields = … -
Django DRF how to overwrite Custom throttles
I want to implement this Custom throttles. I want to disallow every request if it exceeded a certain number of seconds. For example, If anyone sends more than 10 requests per seconds then I want to stop and wait 20seconds before sending new request. I tried this code but didn't work class CstomRateThrottle(throttling.BaseThrottle): def allow_request(self, request, view, wait=20): return True They saying Optionally I may also override the .wait() method but don't know how. -
How to change field value while exporting in Django Export Functionality
When I export category I'm getting only Active value in status column. If category status is 0 then also i'm getting Active. Here is my admin.py from import_export import resources from import_export.admin import ImportExportMixin,ExportActionModelAdmin from .models import Category class CategoryResource(resources.ModelResource): status = Field(column_name='Status') class Meta: model = Category # Fields to export fields = ['name','status','slug'] # Order of Field In export export_order = ['name', 'slug', 'status'] # custom field value if bool function name should be 'dehydrate_<field_name> def dehydrate_status(self, category): if category.status: return 'Active' else: return 'In-active' @admin.register(Category) class CategoryAdmin(ImportExportMixin,ExportActionModelAdmin,admin.ModelAdmin): # Add this to configure export settings resource_class = CategoryResource Anything i'm missing in the code? Using django-import-export -
How to sum with condition in a Django queryset
I am trying to sum Django query with a condition. Suppose I have got some data like this: | Name | Type | --------------- | a | x | | b | z | | c | x | | d | x | | e | y | | f | x | | g | x | | h | y | | i | x | | j | x | | k | x | | l | x | And these types are string and they have values, like x = 1, y = 25, z = -3 How can I sum up all the values without a loop? Currently using a loop. data = A.objects.all() sum = 0 mapp = {'x': 1, 'y': 25, 'z': -3} for datum in list(data): sum = sum + mapp[datum.type] print(sum) -
How to prevent sphinx adding exception and bases objects on documentation
Hi have this sphinx documentation inside my class. I would like to prevent sphnix adding exception and base objects as shown in the screen. Any help please ? class CampaignNamingTool(models.Model): """ The goal of Campaign Naming Tool is to help account mangers to plan their campaigns and to follow nomenclature guidelines and thus avoid bugs or missing campaigns. Because campaigns are case sensitives in the workflow process. So every bad named or misnamed campaign are ignored and it won't be displayed in the users insertions orders. Plase use this formular to create your campaign for the first time. .. admonition:: Important If the campaign does not respect the guidelines, you can't follow it here. It will be missing in the monitoring. Parameters ---------- user : owner or in charge of the campaign. year, month : year and month when launching campaign online. advertiser : advertiser of the campaign. name : name of the campaign. device : device the campaign must be served (Desktop, Mobile, tablette). type_of_format : format that campaign must be served (IAB, Video, etc) kpi : KPI of the campaign (CPM, CPC, CPV, CPA, etc) Returns ------- an Insertion Order object composed by the concatenation of all these … -
cannot access the passed file from swagger ui inside django debugger(pdb)
created an api and added swagger to the api with the help of the package drf-yasg the current updated version 1.20.0, then added code like this success_res_data = openapi.Schema(type=openapi.TYPE_OBJECT, properties={'status': openapi.Schema(type=openapi.TYPE_NUMBER, title='200'), 'success': openapi.Schema(type=openapi.TYPE_OBJECT, properties={'message_header': openapi.Schema(type=openapi.TYPE_STRING), 'message': openapi.Schema(type=openapi.TYPE_STRING)})}) error_res_data = openapi.Schema(type=openapi.TYPE_OBJECT, properties={'status': openapi.Schema(type=openapi.TYPE_NUMBER, title='400'), 'error': openapi.Schema(type=openapi.TYPE_OBJECT, properties={'message_header': openapi.Schema(type=openapi.TYPE_STRING), 'message': openapi.Schema(type=openapi.TYPE_STRING)})}) invitation_file = openapi.Parameter('invitation_file', openapi.IN_QUERY, type=openapi.TYPE_FILE, required=True) @swagger_auto_schema( manual_parameters=[invitation_file], operation_description="description", responses={200: success_res_data, 400: error_res_data} ) def post(self, request): invitation_file = request.data.get('invitation_file', None) this invitation_file variable is returning None even if we pass the file from front-end -
passing a for loop value to bootstarp modal in django
Here i am trying to pass the value outside for loop modal using ajax Here is the reference link which i followed reference link and please help me where i am wrong here is my template.html {% for compliance in compliance %} {% complience_category compliance request.user as compliances %} {% for qualification in compliances %} ..... ..... <td> <button data-toggle="modal" data-target="#modal-default" data-id="{{ qualification.id }}" type="button" class="btn btn-warning margin-bottom edit-qualification"> edit </button> </td> .... ..... {% endfor %} {% endfor %} {% csrf_token %} <div class="modal hid fade" id="modal-default"> <div class="modal-dialog"> <form class="form-horizontal" method="POST" enctype="multipart/form-data" action="{% url 'update_qualifications' qualification.id %}" "> {% csrf_token %} {% if qualification %} <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h3>Update Compliance</h3> </div> <div class="modal-body"> <div class="control-group"> <label class="control-label" for="inputdate_{{qualification.id}}">Expiry Date</label> <div class="controls"> <input type="date" id="inputdate_{{qualification.id}}" name="expiry_date" value="{{qualification.expiry_date|date:'Y-m-d'}}"> </div> </div> </div> <div class="modal-footer"> <button class="btn" data-dismiss="modal">Close</button> <button class="btn btn-primary" type="submit">Save</button> </div> {% endif %} </form> </div> </div> here is my AJAX <script> $(document).on('click','.edit-qualification',function(){ var id = $(this).data('id'); console.log(id) $.ajax({ url:'', type:'POST', data:{ 'id':id, 'csrfmiddlewaretoken': $('input[name=csrfmiddlewaretoken]').val(), }, success:function(data){ $('#modal-default .modal-dialog').html($('#modal-default .modal-dialog',data)); $('#modal-default').modal('show'); }, error:function(){ console.log('error') }, }); }); </script> here when clicking edit of particular item it need to update only for that item Please help me … -
django UploadFileForm with reduced ForeignKey Queryset
I need to find a way to reduce the category queryset with my filters. How can I do this? I have and UploadFileForm based on model: class Files100M(models.Model): id = models.AutoField(primary_key=True) file = models.FileField("File", upload_to=handle_uploaded_file,) project = models.ForeignKey(Project, on_delete=models.CASCADE) category = models.ForeignKey(Category, on_delete=models.CASCADE) date = models.DateTimeField(default=datetime.now, blank=True) The Form class is as follows: class UploadFileForm(forms.ModelForm): ALLOWED_TYPES = ['pdf', 'dwg'] class Meta: model = Files100M fields = ['project', 'category', 'file'] My template looks like this: {% load django_bootstrap5 %} <div class="col-sm-3 col-md-3 col-sm-3 col-lg-2"> {% if file_upload_form %} <form method='post' enctype="multipart/form-data"> {% csrf_token %} {% bootstrap_form file_upload_form %} {% bootstrap_button button_type="submit" content="Upload File" %} {% bootstrap_button button_type="reset" content="Cancel" %} </form> {%endif%} -
how to create multisite django with one database?
I want to create some websites on a server with one database. my structure is: main_domain.com/ main_domain.com/website1 main_domain.com/website2 . . main_domain.com/website_n Some contents are common between websites. I use Django 3 What is best practice for doing this. -
Django Strawberry writing a mutation that includes a foreign key that creates multiple objects
I am trying to have a graphql mutation create the inputs for two django models at once using strawberry. I check the docs here and there were no examples of how to do this. I have the following django model: class Address(models.Model): name = models.CharField() class Person(models.Model): name = models.CharField() address = models.ForeignKey('Address', on_delete=models.CASCADE, blank=False, null=False) With they type.py @strawberry.django.type(models.Address) class Address: id: auto name:auto @strawberry.django.input(models.Address) class AddressInput: id: auto name:auto @strawberry.django.type(models.Person) class Person: id: auto name: auto address:'Address' @strawberry.django.input(models.Person) class Person: id: auto name: auto address:'AddressInput' For the schema.py I have: @strawberry.type class Mutation: createAddress: Address = mutations.create(AddressInput) createPerson: Person =mutations.create(PersonInput) schema = strawberry.Schema(mutation=Mutation) I tried the Mutation but got an error: mutation newPerson ($name: String!, $addressname:String!){ createPerson(data: {name: $name, address: {name: $addressname}}) { id name address { id name } } } #Query Variables { "name": "Min", "addressname": "jkkihh", } Error message: "message": "Field 'id' expected a number but got PersonInput(id=<strawberry.unset._Unset object at 0x00000194FB945C90>, addressname='jkkihh', description=<strawberry.unset._Unset object at 0x00000194FB945C90>, notes=<strawberry.unset._Unset object at 0x00000194FB945C90>)." This is similar the this question I previously asked using graphene. Where it was resolved by making an new object type to store and wrote a mutate function inside a class for mutation. I also … -
HTML min max step validation doesn't work when using javascript to submit
I did use standard html validation for number input (min, max and step). User couldn't write the number exceeding this limit and couldn't use arrows to exceed it either. I had to prevent double clicking Submit button- users sometimes clicked this button very fast and it did add double the objects it supposed to add. So I used some js and jQuery: <script> $(document).ready(function() { $("#addButton").on("click", function() { var $this = $(this); $this.attr('disabled', true); $("#addForm").submit(); }); }); </script> With this way of submiting the form the validation is gone. I still can't use arrows to exceed the limit but user can just type any value. Is there any other way to approach this? I could validate in Javascript but there's a lot of different objects with different validation limits. Or should I ask- is there any other way to prevent double clicking submit button? I use Django and I tried to prevent this action in backend using django-ratelimit but it didn't work like it should @ratelimit(key='ip', rate='2/s') def my_view(request): -
Import "django.db.models" could not be resolved from source / py manage.py makemigrations No changes detected
I am working on a project using django and I am using Visual Studio Code software. In my 'store' directory i have a python package called 'tiendaonline' and the app called "gestionpedidos" where I am trying to create a a Table (DDBB) The problem i am getting is that I cannot create table because when I try to run "py manage.py makemigrations" I can see the msg "No changes detected". Also I can see in the window called problems this msg: " Import "django.db.models" could not be resolved from source " My setting.py is like this: INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'gestionpedidos', ] and my model is this: from django.db import models # Create your models here. class Pedidos(models.Model): numero = models.IntegerField(max_length=100 ) fecha = models.DateField(max_length=300 ) entregado = models.BooleanField() class Clientes(models.Model): name = models.CharField(max_length=30 ) direc = models.CharField(max_length=50 ) Email = models.EmailField() Tel = models.EmailField() class Articulos(models.Model): name = models.CharField(max_length=100 ) seccion = models.CharField(max_length=300 ) price = models.IntegerField() I don't know what is happening. It could give me an adress of migration like "0001_init" but is not running. Thank you -
Set Session Variable in Django Rest Framework
How can i set session variable in DRF view(APIView) and get it in other views of my API. when I set session in any views like request.session['name'] = 'SRJ' I can access this in same view but I cant get it in other views files of API. i know request of django and DRF are different but is there a way to do it ? Thanks for any help -
How to store multiple values inside a foreign key field?
I need to add multiple categories to a brand field. Here is the code class Brand_Category(models.Model): """ this model is use to store the data of products category """ name = models.CharField(max_length=50, unique=True, verbose_name="Brand Category Name") slug = models.SlugField(max_length=140, unique=True, blank=True) created_at = models.DateTimeField(auto_now_add=True, null=True, blank=True) class Brand(models.Model): """ This model is use to store the data of products sub category """ user = models.ForeignKey(User, related_name='brand_user', on_delete=models.CASCADE,null=True,blank=True, default=None) name = models.CharField(max_length=50, unique=True, verbose_name="Brand Name") brand_img = models.FileField(verbose_name='Upload Image') category = models.ForeignKey(Brand_Category, related_name='brand_category', on_delete=models.PROTECT, null=True) slug = models.SlugField(max_length=140, unique=True, blank=True) created_at = models.DateTimeField(auto_now_add=True, null=True, blank=True) I have a brand form where I am adding multiple categories. This categories are stored in the brand_category model, and i would like to save the id of multiple categories into one brand field. how can i add that? i have found about onetomany field in django but it seems to have deprecated, and the other soultions are not similar to my problem. However, a cateogry is not strictly related to any brand -
How to validate the password at DB level in django
I'm trying to register a user with a phone and password, I want to find if the user exists and if the password is the same as we have already on our DB then I want the user to get a login instead of giving an error to that the user with same creds already exists. Now the problem I cant validate the password. I'm trying : registered_user = CustomUser.objects.get(phone_number=data['phone_number']) if make_password(data['password']) == registered_user.passwrod: serializer = UserSerializerWithToken(registered_user, many=False) return Response(serializer.data) But I get registered_user has no attribute password How we can fix this? -
ile "manage.py", line 9, in <module> from django.core.management import execute_from_command_line ModuleNotFoundError: No module named 'django'
#!/usr/bin/env python import os import sys if name == "main": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "api.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv) ~ anyone can explane this code. while ı have trying to run this code with "python manage.py makemigrations" its gives an error: enter image description here but all modules in requrement.txt succsessfully loaded before. -
Administration of different databases of an application with django
I understand how to handle several databases through routers, however, how would it be handled when I have two databases with the same structure but it is required to save the information according to the database chosen by the user when starting a session . I have a session login with its corresponding username and password, in addition to that it is mandatory that the user choose a database through a selector to start the session to the application correctly, this information on the name of the selected database is moves through a session cookie for the entire session (forgive the redundancy), all the operations of the application must be done on the database that was initially selected in the access login, how to correctly route the databases for this case? DATABASES = { 'default' : { 'ENGINE': 'django.db.backends.mysql', 'NAME': env.str('NAME_DB_ZF'), 'USER': env.str('USER_DB'), 'PASSWORD': env.str('PASS_DB'), 'HOST': 'localhost', 'PORT': '3306', }, 'SBOJOZF': { 'ENGINE': 'django.db.backends.mysql', 'NAME': env.str('NAME_DB_ZF'), 'USER': env.str('USER_DB'), 'PASSWORD': env.str('PASS_DB'), 'HOST': 'localhost', 'PORT': '3306', }, 'SBOJOCOL': { 'ENGINE': 'django.db.backends.mysql', 'NAME': env.str('NAME_DB_COL'), 'USER': env.str('USER_DB'), 'PASSWORD': env.str('PASS_DB'), 'HOST': 'localhost', 'PORT': '3306', } }