Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django: Email-Verification at User Registration
So I'm trying to implement an Email-Verification for my Project, so every time a User registers on my Webpage, he has to verify his Email-Address in order to create his account. I understand, that Django-Allauth (https://github.com/pennersr/django-allauth) offers this kind of behavior, but neither the docs nor the tutorials helped me understand how to actually go about it. I know this question is a little vague and to much to ask for, but can anybody give me a hint how I actually start implementing the Verification? Thanks in Advance! -
Guidance to bulk-update MS SQL table from a Django UI with filterable table
I'm relatively new to Django (working through the quickstart), and really like the approach Django takes to rapid development. I'm very familiar with python and pyodbc and REST API's, but relatively new to building for web, and I know that asking for some guidance upfront will probably steer me in the right direction much more quickly than me fumbling around. Some web searches I've been doing for guidance haven't been fruitful so I'm reaching out to this community in the hope that someone can guide the start of this journey for me. I have a case where I have a relatively complex SQL database (Microsoft SQL Server) already designed and partially populated, but essentially need to create a web interface to relatively quickly enable a small group of users to be able to do CRUD-like operations on a few of the tables in the database (excluding the "Create" or "Delete" operations, they will only read and update records already there in the SQL DB). The number of records edited each time will be small - at most, around 6000 records at once. I would like to be able to have a Django web UI view (page) which shows a table … -
Django admin database redirect
I am creating a custom Django admin and I would like for users to go to /admin/database after logging in, all site_urls to go to /admin/database and for all adds/edits/changes to rely on the "database" component, if possible changing /admin/database/location/1/change/. to /database/location/1/change/. Preferably I would like to rename 'admin' to 'database' but I cannot figure out how to do it. The first image is /admin and the second is /admin/database. If in fact i do need to have /admin I would just a link to the app admin interface rather than what it is now. I tried re-assigning admin.site_url but it did not work. The first image is at /admin and the second is at /admin/database (where i want the admin to land when logging in, preferably). -
Django ORM: add parent class and access its class variable from children
I am working on a restaurant app (and new to Django/Python). I want to have a parent class Dish that will contain some counter or ID that increments for every instance of a child class of Dish. The instances are dishes like Pizza, Pasta, etc with different characteristics. I've tried making Dish abstract and non-abstract, but come across different issues each time. This is my Dish class (to make it abstract I tried InheritanceManager(), but ran into complications there that led me to think it's overkill for my simple purposes. Non-abstract, kept giving me You are trying to add a non-nullable field 'pasta_ptr', followd by IntegrityError: UNIQUE constraint failed): class Dish(models.Model): #objects = InheritanceManager() counter = models.PositiveIntegerField(default=0) class Meta: abstract = True This is an example of a child class - I'd like every pasta-entry to get its own Dish-ID or counter on the menu - like a class attribute in Python. How do I access and implement this from the child class? If Dish is not abstract, can I use (& access) Dish's primary key that will tie each dish to my desired ID? class Pasta(Dish): #Dish.counter +=1 name = models.CharField(max_length=64, primary_key=True) price = models.DecimalField(max_digits=6, decimal_places=2) def __str__(self): return … -
Django send mail throwing Server busy error
I am trying to send mails from my django application. But getting the following 401 server too busy. I have tried different email servers all resulting in this following Traceback. How can I solve this error. Thanks. Traceback (most recent call last): api_1 | File "/usr/local/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner api_1 | response = get_response(request) api_1 | File "/usr/local/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response api_1 | response = self.process_exception_by_middleware(e, request) api_1 | File "/usr/local/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response api_1 | response = wrapped_callback(request, *callback_args, **callback_kwargs) api_1 | File "/usr/local/lib/python3.7/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view api_1 | return view_func(*args, **kwargs) api_1 | File "/usr/local/lib/python3.7/site-packages/django/views/generic/base.py", line 71, in view api_1 | return self.dispatch(request, *args, **kwargs) api_1 | File "/usr/local/lib/python3.7/site-packages/rest_framework/views.py", line 505, in dispatch api_1 | response = self.handle_exception(exc) api_1 | File "/usr/local/lib/python3.7/site-packages/rest_framework/views.py", line 465, in handle_exception api_1 | self.raise_uncaught_exception(exc) api_1 | File "/usr/local/lib/python3.7/site-packages/rest_framework/views.py", line 476, in raise_uncaught_exception api_1 | raise exc api_1 | File "/usr/local/lib/python3.7/site-packages/rest_framework/views.py", line 502, in dispatch api_1 | response = handler(request, *args, **kwargs) api_1 | File "/app/api/views/auth/forgot_password.py", line 37, in post api_1 | reset_message = send_mail(subject, html_content, from_email, to, fail_silently=False, html_message=link_message) api_1 | File "/usr/local/lib/python3.7/site-packages/django/core/mail/__init__.py", line 60, in send_mail api_1 | return mail.send() api_1 | File "/usr/local/lib/python3.7/site-packages/django/core/mail/message.py", line 276, in send … -
issue in sending realtime data from esp32 to Django webpage
I am having trouble in sending data from tcp client in my esp32 board to my python django server,I am not familiar with setting channels in Django ,is there a way so that i can send the data and display in my page? -
Can't deploy Django on Heroku
I have a project called "django_project" on local host tested & running. Now i have tried deploying my app at Heroku (really tried everything) but there's error saying: heroku[web.1]: Starting process with command `gunicorn django_projcet.wsgi heroku[web.1]: State changed from starting to crashed heroku[web.1]: Process exited with status 3 app[web.1]: ModuleNotFoundError: No module named 'django_projcet' app[web.1]: [INFO] Worker exiting (pid: 10) app[web.1]: [INFO] Shutting down: Master app[web.1]: [4] [INFO] Reason: Worker failed to boot. My project tree: Procfile: web: gunicorn django_projcet.wsgi Wsgi.py: """ WSGI config for django_project project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_project.settings') application = get_wsgi_application() requirements.txt: boto3==1.12.31 botocore==1.15.31 certifi==2019.11.28 chardet==3.0.4 dj-database-url==0.5.0 Django==3.0.4 django-crispy-forms==1.9.0 django-storages==1.9.1 django-heroku==0.3.1 docutils==0.15.2 gunicorn==20.0.4 idna==2.8 jmespath==0.9.5 Pillow==7.0.0 psycopg2==2.7.7 python-dateutil==2.8.1 pytz==2019.3 requests==2.22.0 s3transfer==0.3.3 six==1.14.0 urllib3==1.25.8 whitenoise==5.0.1 -
Why is this outputs differnt?
from django.shortcuts import render from django.contrib.auth.decorators import login_required from django.utils import timezone from django.db.models import Sum, Count, Max, When, Case, Value, IntegerField from django.db.models.functions import TruncDay, TruncMonth, TruncYear import datetime from .models import Profile, Team @login_required def profile(request): today = timezone.now() user_profile = Profile.objects.filter(user=request.user).first() expenses = user_profile.expense_set.annotate( field = Case( When(created__year=today.year, then=1), When(created__month=today.month, then=2), When(created__day=today.day, then=3), default=0, output_field=IntegerField() ) ) curent_month_expenses = expenses.filter(created__month=today.month) expenses_per_day = expenses.annotate( day=TruncDay('created')).values('day').annotate( expenses=Count('id'), summary=Sum('amount') ).values('day', 'expenses', 'summary') expenses_per_month = expenses.annotate( month=TruncMonth('created')).values('month').annotate( expenses=Count('id'), summary=Sum('amount') ).values('month', 'expenses', 'summary') expenses_per_year = expenses.annotate( year=TruncYear('created')).values('year').annotate( expenses=Count('id'), summary=Sum('amount') ).values('year', 'expenses', 'summary') print(expenses_per_year[0]) print(expenses_per_year.first()) context = { 'profile': user_profile, 'curent_month_expenses': curent_month_expenses, 'yearly_expenses': expenses_per_year, 'dayly_expenses': expenses_per_day, 'monthly_expenses': expenses_per_month, } return render(request, 'accounts/profile.html', context) Why outputs differnt in print statment? Outputs: {'year': datetime.datetime(2020, 1, 1, 0, 0, tzinfo=), 'expenses': 6, 'summary': 128400} {'year': datetime.datetime(2020, 1, 1, 0, 0, tzinfo=), 'expenses': 1, 'summary': 1000} -
Sending Video Stream front-end to backend
I want to pass video frame from Front-end(angularjs) to Back-end(Django) for video sreaming. for that I had followed below link. https://github.com/aiortc/aiortc/tree/master/examples/server for Django,I had used Django-celery Tasks for asynchronuos function. I tried to pass RtcPeerConnection object(as arguement) into celery task that time I got below error TypeError: Object of type RTCPeerConnection is not JSON serializable Any hint will be appreciated. Thank you! -
Is_valid doesn't seem to be true every time I enter submit
views.py @login_required def PasswordChange(request): print('1') #email=User.email form=PasswordChangeForm(user=request.user) print('wee') return render(request, 'password_change.html', {'form':form}) print('eee') if request.method == 'POST': print('doo') form = PasswordChangeForm(user=request.user, data=request.POST) if form.is_valid(): print('2') user = form.save() update_session_auth_hash(request, user) print('3') return render(request, 'success.html') else: form = PasswordChangeForm(user=request.user) ''' urls.py path('passwordchange/', views.PasswordChange, name='passwordchange'), templates {%block content%} <form class="form-vertical" method="POST"> {% csrf_token %} {{ form.as_p }}<br> <button type="submit" class="btn btn-success">Submit</button> </form> {%endblock content%} [31/Mar/2020 18:07:30] "GET /passwordchange/ HTTP/1.1" 200 3919 Not Found: /passwordchange/.jpg [31/Mar/2020 18:07:30] "GET /passwordchange/.jpg HTTP/1.1" 404 8192 1 wee [31/Mar/2020 18:08:00] "POST /passwordchange/ HTTP/1.1" 200 3919 Not Found: /passwordchange/.jpg [31/Mar/2020 18:08:00] "GET /passwordchange/.jpg HTTP/1.1" 404 8192 -
django/python dates does not match
I am trying to filter data from db using the current day. If i give the date as a string it works, but if I use the date.today() method it doesnt. Any idea why I can't use a date in the filter method? today = str(date.today()) #doesnt work, even if I dont convert pickeddate = '2020-03-31' #it works with this print(today, pickeddate) #2020-03-31 2020-03-31 events = CalendarEvents.objects.filter(start_date = today) #only works with pickddate I even tried converting the date like this, but it doesnt worked either: converteddate = datetime.strptime(today, '%Y-%m-%d').date() -
Multiple forms on one site in Django using {% include %} tag
The whole issue is how to include three different forms on one site. Before I start, every form change data in different model so I can't create one massive form, unfortunately... So I have one view which generate page, and three other one whitch handle the forms (i used class-based views -> UpdateView, and I'd rather don't change it) I thought that good solution of this issue will be using {% include %} tags but form doesn't generate. Maybe someone know how to solve this problem. Here is my code: #views def profile(request, pk): return render(request, 'profiles/profile.html', {'profile': Profile.objects.get(user=request.user),}) class ProfileUpdateView(UpdateView): model = Profile template_name = 'profiles/includes/profile_edition.html' form_class = ProfileForm success_url = reverse_lazy('profile') def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['form'] = ProfileForm() return context def form_valid(self, form, **kwargs): form.instance.email = self.request.user.email return super().form_valid(form) <div> <!--main content of site--> </div> <div> <!--first form--> {% include 'profiles/includes/profile_edition.html' with form=form %} </div> <div> <!--second form--> {% include 'other path' with form=form %} </div> -
Getting model serializer field properties through Django Rest
One of the nice things about modelforms in django is that these forms inherit a lot of properties from the model, making form validation a breeze. I'm new to the django rest framework but one thing I'm missing from the tutorials is how to pass all the properties of your models to the frontend. With drf serializers and views you can define properties on the model fields that the api should accept, but how does the frontend know which of these fields are required, what the data type is of the fields and critically what the key value pairs are for choice fields or Foreignkey fields, etc. Some people seem to just hardcode these values in the frontend and write custom api endpoint for only the realy dynamic things like choicefield options (as discussed here). Generic views in drf already include parameter descriptions in response the OPTIONS requests (see here). The major issue I have with this is that it only shows the metadata under actions -> post when the user is authenticated. Can it be defined per model if authentication is required to see the metadata? For user registration for example the user model metadata would have to be … -
Django not serving static files ElasticBeanstalk
I have a Django app that is serving static files from the s3 bucket when I run it locally. but after deploying to EB I am getting 404, as the browser is rendering unexpected links for static files. my setting looks like this STATIC_URL = '/static/' AWS_STORAGE_BUCKET_NAME = 'bucket-name' # or None if using service role AWS_ACCESS_KEY_ID = os.environ.get('S3_ACCESS_KEY') AWS_SECRET_ACCESS_KEY = os.environ.get('S3_SECRET_ACCESS_KEY') AWS_S3_CUSTOM_DOMAIN = '%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME STATICFILES_LOCATION = 'static' STATICFILES_STORAGE = '<app_name>.custom_storages.StaticStorage' MEDIAFILES_LOCATION = 'media' DEFAULT_FILE_STORAGE = '<app_name>.custom_storages.MediaStorage' Heres my custom_storage.py file. from django.conf import settings from storages.backends.s3boto3 import S3Boto3Storage class StaticStorage(S3Boto3Storage): location = settings.STATICFILES_LOCATION class MediaStorage(S3Boto3Storage): location = settings.MEDIAFILES_LOCATION when I am running the app locally, with this setting, the browser is trying to pull static files from https://bucket-name.s3.amazonaws.com/static/{static-file-path} All good so far. Then I deployed the app to EB and hell broke loose. I believe somewhere EB changed STATIC_URL and deployed app is trying to load assets from http://{eb-app-endpoint}/static/main/css/font-awesome.css Its ignoring S3Boto3Storage all together. Is there any setting I am missing? Also, this is the first time I am deploying a production-grade app on EB, any inputs are much appreciated. -
Django System Check Framework
Django’s system check framework mentions that it can be used for static checks. In my django app I need to make sure that a series id default objects have been created by a script. Is there any way for the system checks framework to check the database? https://docs.djangoproject.com/en/3.0/topics/checks/#field-model-manager-and-database-checks -
How to solve " The filename, directory name, or volume label syntax is incorrect: '"C:'"
i tried many ways but still got this Could not install packages due to an EnvironmentError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '"C:' Command ""C:\Users\Umair Zia\PycharmProjects\untitled1\venv\Scripts\python.exe" "C:\Users\Umair Zia\PycharmProjects\untitled1\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip" install --i gnore-installed --no-user --prefix "C:\Users\Umair Zia\AppData\Local\Temp\pip-build-env- g4hyspvc\overlay" --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pyp i.org/simple -- wheel setuptools Cython>=0.29.13 "numpy==1.13.3; python_version=='3.5' and platform_system!='AIX'" "numpy==1.13.3; python_version=='3.6' and platform_system!='AIX'" "nump y==1.14.5; python_version=='3.7' and platform_system!='AIX'" "numpy==1.17.3; python_version>='3.8' and platform_system!='AIX'" "numpy==1.16.0; python_version=='3.5' and platform_system== 'AIX'" "numpy==1.16.0; python_version=='3.6' and platform_system=='AIX'" "numpy==1.16.0; python_version=='3.7' and platform_system=='AIX'" "numpy==1.17.3; python_version>='3.8' and platf orm_system=='AIX'" pybind11>=2.4.0" failed with error code 1 in None -
Django form to save m2m additional fields (using custom through/intermediary model)
I have a "Parent" model, which contains multiple "Child" models and the relationship between Parent and Child holds the order of the children. Thus, I need a custom intermediary model. models.py: class Parent(models.Model): name = models.CharField children = models.ManyToManyField(Child, through=ParentChild) ... class Child(models.Model): name = models.CharField() ... class ParentChild(model.Model): parent = models.ForeignKey(Parent, on_delete=models.CASCADE) child = models.ForeignKey(Child, on_delete=models.CASCADE) order_of_child = IntegerField(null=True, blank=True, unique=True, default=None) A Parent object is created based on a form and the Child objects to be part of the Parent object are selected by checkboxes. Now my questions are: How can the order_of_child be included in the form and rendered alongside the checkboxes and how can the relationship be correctly saved in the view? forms.py: class ParentForm(ModelForm): class Meta: model = Parent fields = ['name', 'children'] def __init__(self, *args, **kwargs): super(ParentForm, self).__init__(*args, **kwargs) self.fields['name'] = forms.CharField(label='Name', widget=forms.TextInput() self.fields['children'] = ModelMultipleChoiceField( widget=forms.CheckboxSelectMultiple(queryset=Child.objects.all()) -
django send mail with formular
I want the user to send an email if he has a question about a product etc. So I did all things I know about it and set the host inside the settings.py EMAIL_HOST = 'smtp.gmail.com' EMAIL_PORT = 465 EMAIL_HOST_USER = 'name@gmail.com' EMAIL_HOST_PASSWORD = 'password' EMAIL_USE_TLS = False EMAIL_USE_SSL = True In the views.py I checked if the config was right and send an email to myself with send_mail('things', 'sub', 'message', 'mail@gmx.de' , ['name@gmail.com'], fail_silently=False) So now I made an mail formular where the user can iput his name, email and the message <form method="POST" action="/contact/"> {% csrf_token %} <div class="row mb-3"> <div class="col"> <label>name * </label> <input type="text" class="form-control" placeholder="name" name="conName"> </div> <div class="col"> <label>message *</label> <input type="text" class="form-control" placeholder="message" name="conText"> </div> </div> <div class="mb-3"> <label>Email-Adresse * </label> <input type="email" class="form-control" placeholder="pablo@picasso.de" name="conEmail"> </div> </div> <button type="submit" class="btn btn-outline-success">Abschicken</button> </form> Now I need to change the views.py that the user input is placed and sended: from django.shortcuts import render from django.core.mail import send_mail, EmailMultiAlternatives # from .models import Contact_formular def contactFormular(request): return render(request, 'contact.html',{}) if request.method == 'POST': name = request.POST['conName'] email = request.POST['conEmail'] message = request.POST['conText'] send_mail('New request', name, message, email , ['name@gmail.com'], fail_silently=False) But the form isnt … -
Django rest Framework empty response with gunicorn, but works with runserver
I am trying to implement an Oauth2 authentication using django-oauth-toolkit, and the key exchange works when I am using the built-in django server. However, when I am using gunicorn, I have an empty response. All the other endpoints work fine with gunicorn: view.py from rest_framework.response import Response from rest_framework.decorators import api_view, permission_classes from rest_framework.permissions import AllowAny import requests from .serializers import CreateUserSerializer @api_view(['POST']) @permission_classes([AllowAny]) def register(request): ''' Registers user to the server. Input should be in the format: {"username": "username", "password": "1234abcd"} ''' # Put the data from the request into the serializer serializer = CreateUserSerializer(data=request.data) # Validate the data if serializer.is_valid(): # If it is valid, save the data (creates a user). serializer.save() # Then we get a token for the created user. # This could be done differentley r = requests.post('http://127.0.0.1:8000/o/token/', data={ 'grant_type': 'password', 'username': request.data['username'], 'password': request.data['password'], 'client_id': get_client_id(), 'client_secret': get_client_secret(), }, ) return Response(r.json()) return Response(serializer.errors) @api_view(['POST']) @permission_classes([AllowAny]) def token(request): ''' Gets tokens with username and password. Input should be in the format: {"username": "username", "password": "1234abcd"} ''' r = requests.post('http://127.0.0.1:8000/o/token/', data={ 'grant_type': 'password', 'username': request.data['username'], 'password': request.data['password'], 'client_id': get_client_id(), 'client_secret': get_client_secret(), }, ) return Response(r.json()) @api_view(['POST']) @permission_classes([AllowAny]) def refresh_token(request): ''' Registers user to the server. … -
How do I create several similar links to products automatically in Django?
Say, I need to output some vacancies alvaible, do I have to create a template for every one of them somehow, or i can do it another way, for example, having one template and adding new id's to urls.py? -
Want to change iframe url parameter using python django
I want to change my iframe src url parameter multiple time using Django i also tried to do that using loop but failed i want to see parameters between 1 to 1000000 Code:- <body> <iframe height="300px" src="https://example.com/id=source/Id_22.pdf"></iframe> </body> Want to chnage in <body> <iframe height="300px" src="https://example.com/id=source/Id_23.pdf"></iframe> </body> <body> <iframe height="300px" src="https://example.com/id=source/Id_24.pdf"></iframe> </body> <body> <iframe height="300px" src="https://example.com/id=source/Id_25.pdf"></iframe> </body> -
Django override admin template delete_confirmation
In my templates/admin/my_app/my_model/ folder I added delete_confirmation.html in which I copied and pasted and added a line <h1>Not permitted</h1> {% extends "admin/base_site.html" %} {% load i18n admin_urls %} {% block breadcrumbs %} <div class="breadcrumbs"> <a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> &rsaquo; <a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ app_label|capfirst }}</a> &rsaquo; <a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst|escape }}</a> &rsaquo; <a href="{% url opts|admin_urlname:'change' object.pk|admin_urlquote %}">{{ object|truncatewords:"18" }}</a> &rsaquo; {% trans 'Delete' %} </div> {% endblock %} {% block content %} {% if perms_lacking or protected %} {% if perms_lacking %} <h1>Not permitted</h1> <p>{% blocktrans with escaped_object=object %}Deleting the {{ object_name }} '{{ escaped_object }}' would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:{% endblocktrans %}</p> <ul> {% for obj in perms_lacking %} <li>{{ obj }}</li> {% endfor %} </ul> {% endif %} {% if protected %} <p>{% blocktrans with escaped_object=object %}Deleting the {{ object_name }} '{{ escaped_object }}' would require deleting the following protected related objects:{% endblocktrans %}</p> <ul> {% for obj in protected %} <li>{{ obj }}</li> {% endfor %} </ul> {% endif %} {% else %} <p>{% blocktrans with escaped_object=object %}Are you sure you want to delete … -
Using global variables in django testing is a best practice..?
In django testing I have a Imagefield which is used in many test cases, In order to avoid the repetition I have assigned the Imagefile obj to the global variable file = open(os.path.join(settings.BASE_DIR, 'logged_out.jpg'), 'rb') image = {'image':SimpleUploadedFile(name=file.name, content=file.read(), content_type='image/jpeg')} class FeedFormTest(TestCase): def setUp(self): self.user = baker.make(SnetUser) self.data = { 'post_info':'Test_data', } def test_feed_form_is_valid(self): #Option 1 Not working #self.data.update(image) #form = FeedForm(self.data) #Option 2 Not working #form = FeedForm(self.data, image) #Option 3 Working form = FeedForm(self.data, image) #locally defined image in SetUp method instead globally print(form.errors) self.assertTrue(form.is_valid()) When I execute the test it's working only for the image which is defined inside the setUp method of test class. Can you suggest or guide me the method in using the variables effectively without defining it multiple times. As I have other variables too like user credentials -
Django: Fixture already exists?
I'm installing Django fixtures for testing and I keep getting an error saying I'm violating a UniqueConstraint. This data came from python manage.py dumpdata > data.json. It's working on the database side. It's loaded in to a test via fixtures=[], so there's nothing to violate. django.db.utils.IntegrityError: Problem installing fixture '/Users/aaron/Github/foo-server/fooproject/items/fixtures/default_items.json': Could not load invites.InviteCode(pk=01e710b8-05c8-41b3-b9cf-5d059cbe4101): duplicate key value violates unique constraint "invites_invitecode_user_id_key" DETAIL: Key (user_id)=(432d2a2e-6c5d-4502-8c99-86c71a6f45d6) already exists. -
How do i include variables in url inside of Flutter
I want to put the value of email an password in the middle of the url insted of 1111 and 22222. The email and password values comes form text controllers and stored in email and password string. How can i put them in middle of url. I tired ${email} insted of 1111 it gave error only static member can be initialized String email = ""; String password = ""; String url ="http://2i6b753b.ngrok.io/authenticate/1111/22222";