Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
ModuleNotFoundError: No module named 'ramaelectricstore.wsgi.application'; 'ramaelectricstore.wsgi' is not a package
I am traying to deploy Django app on AWS EC2 instance but after running this command 4-144:~/ramaelectricstore/ramaelectricstore$ gunicorn --bind 0.0.0.0:8000 ramaelectricstore.wsgi.application I am facing this Error please help me ModuleNotFoundError: No module named 'ramaelectricstore.wsgi.application'; 'ramaelectricstore.wsgi' is not a package -
Clicking on submit at billing address form redirects me at login, instead of redirecting me to shipping address form
I am following a tutorial explainig how to build an eCommerce app with django. I have a cart section [s1] where the customer can see the resume of the products he/she has in the cart. Here the customer can click on a "checkout" button that, according to the tutorial, if the customer is logged in: should lead him/her to a shipping address section [s2] where he/she can fill the shipping address form. else: should lead him/her to a guest authentication section [s2-b] where he/she can continue as guest (the customer is requested to submit his/her email address) or login (the customer is requested to submit user and password) and then reaches the shipping address form section [s2]. Then the app should lead the customer to a billing address form [s3] and then to a finalizing section [s4]. My problem is that I can't go past the shipping address section [s3], because as I click on the submit button, the app redirects me to the login form, (this happens even if I am already logged in) where the message "This field is required" appears for both user and password files, and as I type those in and press Submit button, the … -
page not found in django?
i am new to django. this is the error i keep getting when i try to visit node.name page. page not found Request URL: http://127.0.0.1:8000/Category// urls.py Category/<category_id>/ [name='productlisting'] index.html {% load mptt_tags %} <ul class="root"> {% recursetree listing %} <li> <a href="Category/{{ category_id }}/">{{ node.name }}</a> </li> {% endrecursetree %} </ul> thanks in advance. -
How to develop Cart models and Cart Items model in django rest framework
I am trying to create models for backend in django rest framework. Most of the developers I saw used two models namely Cart and Cart Items for creating cart which is as follows: class Cart(models.Model): owner = models.OneToOneField(User, related_name="cart", on_delete=models.CASCADE, null=True, blank=True) number_of_items = models.PositiveIntegerField(default=0) total = models.DecimalField(default=0.00, max_digits=5, decimal_places=2) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) def __str__(self): return f"User: {self.owner}, items in cart {self.number_of_items}" class CartItem(models.Model): cart = models.ForeignKey(Cart, on_delete=models.CASCADE) item = models.ForeignKey(Product, on_delete=models.CASCADE) quantity = models.IntegerField() I am confused as to why one has to create two models. What is the actual use for it? And isnt the item should be many to many fields instead of the foreign key because we are supposed to add multiple products on the cart. Also, why is there number_of_items and also quantity at same time? What is the difference?? My proposed model: class Cart(models.Model): owner = models.OneToOneField(User,related_name="cart", on_delete=models.CASCADE, null=True, blank=True) item = models.ManytoManyField(Product,blank =True, null =True) number_of_items = models.PositiveIntegerField(default=0) total = models.DecimalField(default=0.00, max_digits=5, decimal_places=2) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) -
discord.py covid module doesn't work AttributeError: Extra: no attribute 'allow'
I am trying to run the bot on a VPS machine, but I get a bug in the console related to the covid module, but on the computer everything worked as it should. Error in console: Traceback (most recent call last): File "/home/dBot/bot.py", line 10, in <module> from covid import Covid File "/usr/local/lib/python3.10/site-packages/covid/__init__.py", line 2, in <module> from covid.john_hopkins import Covid as JohnHopkinsCovid File "/usr/local/lib/python3.10/site-packages/covid/john_hopkins/__init__.py", line 1, in <module> from .covid import Covid File "/usr/local/lib/python3.10/site-packages/covid/john_hopkins/covid.py", line 5, in <module> from covid.john_hopkins.models import CovidModel, CountryModel File "/usr/local/lib/python3.10/site-packages/covid/john_hopkins/models.py", line 5, in <module> from pydantic import BaseModel, Field File "/usr/local/lib/python3.10/site-packages/pydantic/__init__.py", line 2, in <module> from . import dataclasses File "/usr/local/lib/python3.10/site-packages/pydantic/dataclasses.py", line 7, in <module> from .main import create_model, validate_model File "/usr/local/lib/python3.10/site-packages/pydantic/main.py", line 333, in <module> class BaseModel(Representation, metaclass=ModelMetaclass): File "/usr/local/lib/python3.10/site-packages/pydantic/main.py", line 326, in __new__ cls.__signature__ = ClassAttribute('__signature__', generate_model_signature(cls.__init__, fields, config)) File "/usr/local/lib/python3.10/site-packages/pydantic/utils.py", line 229, in generate_model_signature if config.extra is config.extra.allow: File "/usr/local/lib/python3.10/enum.py", line 146, in __get__ raise AttributeError( AttributeError: Extra: no attribute 'allow' -
How to get mypy to recognize login_required decorator?
I have the following Django view: @login_required def view(request: HttpRequest) -> HttpResponse: if not request.user.some_attribute: return redirect("somewhere") return render(request, "template_name") and a custom User model that has an attribute some_attribute. I use mypy to enforce type checking, with this mypy.ini: [mypy] ignore_missing_imports = True plugins = mypy_django_plugin.main [mypy.plugins.django-stubs] django_settings_module = [PROJECT NAME].settings However, mypy errors with the following: Item "AnonymousUser" of "Union[User, AnonymousUser]" has no attribute "some_attribute" which makes sense because an anonymous user wouldn't have that attribute, but I have a login_required decorator, making AnonymousUsers impossible (it would be a User). How do I tell mypy to ignore this, without using # type: ignore? -
Django email not sent, but executed in the console
I have a sender for a password change signal. When I use endopint, it should send an email, but it only does it in the console. EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' EMAIL_HOST = 'smtp.gmail.com' EMAIL_PORT = '465' EMAIL_HOST_USER = "*******" EMAIL_HOST_PASSWORD = "******" EMAIL_USE_SSL = True EMAIL_USE_TLS = False DEFAULT_FROM_EMAIL = "*******" Console successfully outputs: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: =?utf-8?b?0JTQvtCx0YDQviDQv9C+0LbQsNC70L7QstCw0YLRjCDQvdCwIHNpenpl?= From: ******** To: kabiljanz0301@gmail.com Date: Sat, 13 Feb 2021 16:30:12 -0000 Message-ID: <161323381275.176437.7948111011454591000@kabiljan-Lenovo-IdeaPad-S340-14API> /user/password_reset/?token=d2883b6ae18eb357ac1 ------------------------------------------------------------------------------- what could be the problem? -
Loop through and Merge Querysets
I am sure this one is straight forward but I cannot seem to get my head around it. I have "Users" who can post "Posts" on my site. Each user can follow other users. The idea is to display all the posts posted by the users that current user is following. Example : Foo followed Bar and Baz. I need to retrieve all the posts from Bar and Baz. Bar = Post.objects.filter(user=3) Baz = Post.objects.filter(user=4) totalpost= list(chain(Bar, Baz)) print(totalpost) On this occasion, when both variables userXposts and temp are hardcoded, I can easily retrieve ONE list of QuerySets neeatly by chaining both QuerySets. However, I cannot have those hardcoded. As such, I am attempted to loop through each user posts and add it in a list since my user can follow X amount of users : QuerySet = Profile.objects.filter(follower=1) for x in QuerySet: userXposts = Post.objects.filter(user=x.user.id) temp = userXposts totalpost= list(chain(userXposts, temp)) temp = [] print("Totalpost after union of userpost and temp: ", totalpost) Here, Profile.objects.filter(follower=1) return two sets of QuerySets, one for Baz and one for Bar. The problem that I have so far is that totalpost endup being a "list of list" (I believe) which forces me to … -
Django models custom error message gets override by serializer
so i'm new to django and i am using django rest framework alongside it. i was trying to customize django model validation error message but when i used the DFR ModelSerializer my custom error message was replaced by ModelSerializers default or that's what i think happened. my class is like this class Category(models.Model): name = models.CharField(max_length=200, blank=False, error_messages={ 'blank': "please enter some name" }) and this is my serializer class CategoryInp(serializers.ModelSerializer): class Meta: model = Category fields = '__all__' for validating my input i wrote this class CategoryView(APIView): def post(self, request): cat = CategoryInp(data=request.data) if not cat.is_valid(): print(cat.errors) i expected to my custom error message to be printed but instead this was printed 'name': [ErrorDetail(string='This field may not be blank.', code='blank')] thanks in advance -
Heroku git push Django migration failure for DuplicateTable
Background Migrating a Django app from Digital Ocean to Heroku. I had problems migrating the data, so I used pg_dump to get the schema and the data of each table. Then ran those scripts in heroku. I loaded my website and I can see the new data coming through. Problem Now when I push new code with the Heroku CLI that auto runs the deployment, it fails for this reason: psycopg2.errors.DuplicateTable: relation "django_content_type" already exists The commands I run are git add . git commit -m "some message" git push heroku master" The Procfile has release: python manage.py migrate which runs the commands, which I thought about taking it out but when I have migrations to run in the future this will cause an issue. Any thoughts? -
Django update dropzone images in a form with other form data
I am building a Django web app that has data entry that includes multiple images upon form submission and I am using dropzone. I have managed to do the create part successfully. However, my challenge comes when I want to update the form. From the views.py file, I am able to send all the rest of the form data for update. My problem is how to obtain images using dropzone in the form so that I can display their thumbnails. My view looks like this: @login_required def vehicle_update(request, pk): listing = get_object_or_404(Listing, pk=pk) template_name='listings/update_vehicle.html' if request.method == 'POST': # Update the data else: listing_form = ListingDetails(instance=listing) vehicle_form = VehicleDetails(instance=listing.vehicle, initial = {'make': listing.vehicle.model.make }) image_list = ListingImages.objects.filter(listing=listing) return render(request, template_name, { 'form': listing_form, 'vehicle_form': vehicle_form, }) So, at this point, I am not sure if the way I am sending images in the else: block is correct. Then, secondly, how to receive images for processing using dropzone.js in the template. I have tried search around but most of the solutions available are for php or the file name is known and location. This is what I have tried with the dropzone function but seems not to be working. var mocks … -
hide the hash, algorithm, salt, etc. information in the password field
I have a question about Django Admin. I don't want to show hashes, algorithms, salts, etc. in the password field of the admin panel. In this case, the ReadOnlyPasswordHashWidget in django.contrib.auth.forms I thought that I could change the variable that points to the template in the class. However, no matter what I did, I could not change it. I could not change it in any way, for example, by creating an app and putting it on django.contrib.auth in INSTALL_APP, or by creating an administrator app that aims to inherit from BaseUser and adding ReadOnlyPasswordHashWidget class to their forms, but it didn't work. I also tried overriding the static/templates/auth/widgets/read_only_password_hash.html file to override the template directly, but that didn't work either. The goal is to display only the help text that comes standard. What would be the best way to do this? Is there any other way? Thank you for reading this far. Regards. -
ModuleNotFoundError: No module named 'rest_framework.response'
in windows from rest_framework import serializers is working. but in 'view.py' file from rest_framwork.response import Response is not working. please help! I checked 'setting.py' file , pip list and runserver state. INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'mood', 'rest_framework', ] $ pip list Package Version --------------------- ------- asgiref 3.3.1 Django 3.1.6 pip 21.0.1 Python-Rest-Framework 0.3.14 pytz 2021.1 setuptools 41.2.0 six 1.15.0 sqlparse 0.4.1 (venv) ModuleNotFoundError: No module named 'rest_framework.response' what should i do...... -
I have 2 views that have identical post methods, what is the best way to remain DRY
I have a real estate website that has 2 views for 2 separate pages. Each page has a form that allows you to edit the transaction details. One of the pages also allows you to do other things that require the post method. So the views basically look like this: class ViewOne(ListView): # ... def post(self, request, *args, **kwargs): # update transaction logic class ViewTwo(ListView): # ... def post(self, request, *args, **kwargs): # update transaction logic # additional post logic What is the best way to add the post logic that updates the transaction to each view without writing duplicate code? -
How exactly should one merge CRUD or Django templates
In my previous question I asked coders that how can I add multiple articles in my news website without creating a new Html file for each article as it would be difficult to manage so many files on IDE and it also looks impractical. As answers I got recommendation to use Django templates and CRUD to solve these things. I also asked that how big websites like theverge and huffpost manage so many articles on their website but I didn't get satisfactory answer to that. So right now I have only made a homepage using HTML and CSS and that page has various cards for news articles with titles that must open an article when clicked upon. These links are obviously non working right now as I have not put anything in the href tag on their respective HTML files because of reasons I mentioned above. Please Guide me step by step on how should I proceed from here. ///Try to give me all instructions Considering me a complete newbie and noob even the smallest ones. You may also recommend me any article or Youtube video if it describes about my problem exactly. I have already surfed the internet enough … -
Trying to upload audio file with model, but getting "Not Found" error (Django)
I have a 'Music' model which allows a user to upload an audio file through the "FileField". The file gets uploaded to my media folder fine, but the player in the profile.html, comes back with 'error' and in the terminal it says "Not Found" followed by the audio files path. I'm still new to django, so I'd appreciate it if someone can point out what I'm doing wrong here. This is the error in the terminal: Not Found: /my-profile/djangoapp1/media/path/to/audio/05_-_Bicycle_Race.mp3 [13/Feb/2021 15:44:44] "GET /my-profile/djangoapp1/media/path/to/audio/05_-_Bicycle_Race.mp3 HTTP/1.1" 404 6743 models.py class Music(models.Model): track = models.FileField(upload_to='path/to/audio') title = models.TextField(max_length=50) artwork = models.ImageField(upload_to='path/to/img', blank=True) artist = models.ForeignKey(User, on_delete=models.CASCADE) def __str__(self): return self.title forms.py class MusicForm(forms.ModelForm): class Meta: model = Music fields = ['track', 'title', 'artwork'] widgets = { 'title': forms.Textarea(attrs={'rows':1, 'cols':1}), } views.py @login_required def music_upload(request): if request.method == "POST": form = MusicForm(request.POST, request.FILES) if form.is_valid(): user = request.user song = form.save(commit=False) song.artist = user song.save() messages.success(request, f'Track Uploaded') return redirect('my_profile') else: form = MusicForm() return render(request, 'feed/music_upload.html', {'form':form}) profile.html <h3>MUSIC</h3> <audio controls> <source src="djangoapp1/media/path/to/audio/05_-_Bicycle_Race.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio> -
I want to create search box
i am using a usercreation form to to create a user i also create a extra model name profile to store some extra data about user with the help of signal and what i want is that search result show one specific result with that username link havings its data on it class SignUpForm(UserCreationForm): first_name = forms.CharField(max_length=30, required=True, help_text='Required.') last_name = forms.CharField(max_length=30, required=False, help_text='Optional.') email = forms.EmailField(max_length=254, required=True, help_text='Required. Inform a valid email address.') class Meta: model = User fields = ('username', 'first_name', 'last_name', 'email', 'password1', 'password2',) model for that user who can store extra data about himself and create automatically a profile by signal from django.db import models from django.contrib.auth.models import User from django.utils import timezone from django.db.models.signals import post_save from django.dispatch import receiver Create your models here. class Profile(models.Model): user = models.OneToOneField(User ,on_delete=models.CASCADE,) profile_pic = models.ImageField(upload_to='profile_pics',default='default.png',) twitter = models.URLField(max_length=80, blank=True,) facebook = models.URLField(max_length=80, blank=True,) about = models.CharField(max_length=1500, blank=True,) joined_date = models.DateTimeField(default=timezone.now,editable=False) dob = models.DateField(blank=True,null=True) update_at = models.DateTimeField(auto_now=True) def __str__(self): return self.user.username @receiver(post_save, sender=User) def create_user_profile(sender, instance, created, *args, **kwargs): if created: Profile.objects.create(user=instance) @receiver(post_save, sender=User) def save_user_profile(sender, instance, **kwargs): instance.profile.save() -
Problems configuring Apache2 WSGI django
So I am building a blog engine for my class. It is supposed to be an easy assignment, but for some reason, I cannot get Django working on apache 2, and I have not even started on the databases, which is the goal of this project. I have re-installed apache2 a hand full of times with no success. same with WSGI, and I have followed this guide fairly closely, only really changing names of folders to be more in line with the project https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-apache-and-mod_wsgi-on-ubuntu-16-04 I tested with ./manage.py runserver 0.0.0.0:8000, and everything on the test domain checked out fine. picture of working port 8000 here is my final configuration file <VirtualHost *:80> # The ServerName directive sets the request scheme, hostname, and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName … -
How to do text based filtering on DateTimeFields using a specific template format?
I have a table that includes both CharFields and DateTimeFields displayed using django template language. The DateTimeFields are displayed in the format "Aug. 18, 2020, 6:33 p.m.". Is there an easy way to do a text based filter/query on the DateTimeFields based on that specific format? For example, searching "aug" or "Aug" or "Aug. 18" or "2020" should find that entry. I've tried icontains, but that seems to work on the underlying format, rather than the display format. For example, searching "2020-08" finds that entry, but searching "Aug" does not. Works: Entry.objects.get(created__icontains='2020') Entry.objects.get(created__icontains='2020-08') Entry.objects.get(created__icontains='33') Does not work: Entry.objects.get(created__icontains='Aug') Entry.objects.get(created__icontains='6:33') Entry.objects.get(created__icontains='p.m') Is there a way to search the using the specific dat time display format? What format is the underlying DateTimeField? Is it DB dependent? -
2021 python-social-auth "facebook Authentication process canceled" on production, but works on localhost
In my Django=2.2 app I want to implement facebook login via python-all-auth. But I am faceing a problem with authentication on production. Here some details: When I use facebook login on localhost, everything is working as expected. When clicking on fb login icon, I am being redirected to fb page, I give permittion to the application to my data and I am being redirected back to the main page with User being logged in. User is created in the both tables 'Social Account Users' and my custom 'User' table. BUT then on production, adjusting settings in facebook app accordingly, facebook authentication is being canceled. Same, after clicking on fb login icon I am being redirected to facebook page, pop up window is showing up and askig to give permittion to application by clicking "continue as a user" I am being redirected to main page with a message 'Authentication process canceled' with debug=True, the error is: Environment: Request Method: GET Request URL: http://www.sellspot.pl/oauth/complete/facebook/?granted_scopes=email%2Cpublic_profile&denied_scopes&code=SOME_CODE Django Version: 2.2.17 Python Version: 3.7.4 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'crispy_forms', 'django.contrib.humanize', 'bootstrap_pagination', 'storages', 'social_django', 'auctions', 'users', 'data', 'contact_us', 'report'] Installed Middleware: ('whitenoise.middleware.WhiteNoiseMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'social_django.middleware.SocialAuthExceptionMiddleware') Traceback: File … -
Simplify form submission in Django
I have a form in Django where the user can submit a file/ an image/ text in a single form as follows. <form id="send-form" action="{% url 'chat:message' context.room_id %}" method="post" enctype="multipart/form-data"> {% csrf_token %} <table style="width: 100%"> <input type="hidden" name="from" value="{{ user }}"> <input type="hidden" name="next" value="{{ request.path }}"> <tr style="width: 100%"> <td style="width: 50%"> <input type="text" id="chat-input" autocomplete="off" placeholder="Say something" name="text" id="text"/> </td> <td style="width: 16%"> <input type="file" name="image" accept="image/*" id="image"> </td> <td style="width: 16%"> <input type="file" name="file" accept="image/*" id="file"> </td> <td style="width: 16%"> <input type="submit" id="chat-send-button" value="Send" /> </td> </tr> </table> </form> In views.py, the form has to be submitted even if any of the three inputs is missing i.e, even if user submits only text/ only image/only file, the data has to be uploaded into database and I have written using try and except in the following way: def messages(request, room_id): if request.method == 'POST': try: img = request.FILES['image'] except: img = None try: text = request.POST['text'] except: text = None try: file = request.FILES['file'] except: file = None path = request.POST['next'] fields = [img,file,text] ChatMessage.objects.create(room=room,user=mfrom,text=text,document=file,image=img) Is there any other better way to do it. The code looks not so good with all the try excepts. -
media part in django is not coming
I cant upload an image file. media file doesn't come in django when i upload an image. i add settings.py MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') urls.py urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) views.py def addArticle(request): form = ArticleForm(request.POST or None,request.FILES or None) if form.is_valid(): article = form.save(commit=False) article.author = request.user article.save() messages.success(request,"Makale Başarıyla Oluşturuldu.") return redirect("index") return render(request,"addarticle.html",{"form":form}) forms.py class ArticleForm(forms.ModelForm): class Meta: model = Article fields = ["title","content","article_image"] when i upload an image in to my article i got nothing to view -
Store procedure returns Error converting data type varchar to int. (8114) (SQLExecDirectW)')
I am trying to use stored procedure to do CRUD operations but while updating i am getting the error Error converting data type varchar to int. (8114) (SQLExecDirectW)'). I wrote a function to return null strings to an integer and return it and it seems to work fine (I printed the result) but I get error. Here is the stored procedure: USE [testenr] GO CREATE PROCEDURE [dbo].[updateJobPost] @id int = Null, @TopicName nvarchar(300) = NULL, @UpdatedDate datetime2(7) = NULL, @IsActive bit = 0, @IsClose bit = 1, @ForceCloseReason nvarchar(3999) = NULL, @IsNotification bit = 0, @SMSText nvarchar(150) = NULL, @WhatsAppText nvarchar(1000) = NULL, @Category_id int = NULL, @CloseBy_id int = NULL, @ForceCloseCategory_id int = NULL, @SubCategory_id int = NULL, @User_id int = NULL AS UPDATE [dbo].[accounts_topiclist] SET [TopicName]=@TopicName, [UpdatedDate]=@UpdatedDate, [IsActive]=@IsActive, [IsClose]=@IsClose, [ForceCloseReason]=@ForceCloseReason, [IsNotification]=@IsNotification, [SMSText]=@SMSText, [WhatsAppText]=@WhatsAppText, [Category_id]=Category_id, [CloseBy_id]=@CloseBy_id, [ForceCloseCategory_id]=@ForceCloseCategory_id, [SubCategory_id]=@SubCategory_id, [User_id]=@User_id WHERE id = @id GO Here is the view: def post(self, request, pk): pk = self.kwargs.get('pk') if request.method == 'POST': topicname = request.POST['TopicName'] category_id = AllProcedures.empty(request.POST['Category']) sub_Category = AllProcedures.empty(request.POST['SubCategory']) isActive = request.POST.get('IsActive') active = AllProcedures.boolcheck(isActive) isClose = request.POST.get('IsClose') close = AllProcedures.boolcheck(isClose) closed_by = AllProcedures.empty(request.POST['CloseBy']) closereason = request.POST['ForceCloseReason'] CLosedCategory = AllProcedures.empty(request.POST['ForceCloseCategory']) isNotify = request.POST.get('IsNotification') notify = AllProcedures.boolcheck(isNotify) sms = request.POST['SMSText'] wap … -
What is django.db.utils.OperationalError: (2000, 'Unknown MySQL error')
Whenever I enter python .\manage.py runserver on django, this error: django.db.utils.OperationalError: (2000, 'Unknown MySQL error') appears. I think it is a client side error as other people running the same project do not have this error. Does anyone know what the error is and potentially how to fix it? -
How to use allauth-socialaccount for Apple provider
Into my Django project (for RESTful services to a mobile app) I'm using allauth + allauth.socialaccount to support social login as also the standard sign-in. As social login I'm using allauth.socialaccount.providers.facebook as Facebook provider. Now, as requested by Apple, It' necessary to integrate Apple-login also. As reported into all-auth release-notes, from 0.43.0 version it's supported Apple provider also. So, I would like to try to integrate it. Where can I found the documentation for this (or also a quick example)? I'm not sure I understand exactly the flow used in this implementation. For example, how should the url callback be handled? Is there some additional urls as documentation? Are there some example projects? I need to understand exactly the flow because I need to customize it (not only about the URLs but also about custom additional fields)