Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Terminal is stuck on python manage.py makemigrations and runserver
I am using Pycharm for django development, after adding some models to the models.py the terminal is stuck at python manage.py makemigrations command, runserver doesn't work also. The terminal is freezing. It was working perfectly, it did not work after the modification in models.py, I tried to delete the migration files but it didn't work, restart the computer didn't help. Look at the pictures please. Any ideas? Thanks a lot makemigrations runserver -
python module installation error when deploying a Django application on heroku
I am deploying my django application on heroku. but when installing the modules from the requirement.txt file, it returns an error on the "Paydunya" module. I am deploying my django application on heroku. but when installing the modules from the requirement.txt file, it returns an error on the "Paydunya" module. I need your help to solve this problem. Thank you here is my requirement.txt file : six==1.15.0 dj-database-url==0.5.0 Django==3.2 django-advanced-filters==1.3.0 django-allauth==0.44.0 django-appconf==1.0.4 django-braces==1.14.0 django-compressor==2.4 django-crispy-forms==1.11.2 django-debug-toolbar==3.2 django-filter==2.4.0 django-heroku==0.3.1 django-markdown-deux==1.0.5 django-money==1.3.1 django-pagedown==2.2.0 django-rest-framework==0.1.0 django-tastypie==0.14.3 django-tinymce==3.3.0 django-videofield==0.1.1 django-widget-tweaks==1.4.8 djangorestframework==3.12.4 docutils==0.17 fpdf==1.7.2 future==0.18.2 gunicorn==20.1.0 html5lib==1.1 idna==2.10 joblib==1.0.1 Markdown==3.3.4 markdown2==2.4.0 Pillow==8.2.0 Pygments==2.8.1 PyJWT==2.0.1 pyparsing==2.4.7 PyPDF2==1.26.0 python-decouple==3.4 python-dotenv==0.17.0 requests==2.0.1 requests-mock==1.3.0 requests-oauthlib==1.3.0 rjsmin==1.1.0 simplejson==3.17.2 sqlparse==0.4.1 suit==2.0.2 urllib3==1.26.4 virtualenv==20.4.3 whitenoise==5.2.0 xhtml2pdf==0.2.5 paydunya==1.0.6 Here is the Heroku CLI : C:\Users\aba\Desktop\comsoc-ugb>git push heroku master Enumerating objects: 17, done. Counting objects: 100% (17/17), done. Delta compression using up to 4 threads Compressing objects: 100% (15/15), done. Writing objects: 100% (15/15), 1.33 KiB | 1.33 MiB/s, done. Total 15 (delta 10), reused 0 (delta 0), pack-reused 0 remote: Compressing source files... done. remote: Building source: remote: remote: -----> Building on the Heroku-20 stack remote: -----> Using buildpack: heroku/python remote: -----> Python app detected remote: -----> No Python version was specified. Using … -
Django LogoutView redirect to previous page
I am using Django's auth.LogoutView class in my urls.py. I can redirect the user to a specific page using LogoutView.as_view(next_page='main:index') after logout. If I left out the next_page part, it redirects to a Django admin interface with a thank you message and a option to login again, which is the admin login page. I want to redirect the user to the page they were on before clicking the logout url on the navbar. -
How can I return a response from docker url in Django?
I'm trying to make a textbox area. In that textbox area user will going to write a sentence and then they will recieve a output about that text. Output is coming from a docker image. And I try to connect them locally by writing it's url. Here my views.py, urls.py and html file. views.py def sentiment(request): url = "http://localhost:5000/sentiment" #this is my local docker image url. input_text = request.GET.get('text') try: response = request.get(url+input_text).json() context = { 'text':text } return render(request,'blog/links/Link1.html',context) except: return redirect ("/duyguanalizi") urls.py from django.urls import path from . import views from django.contrib.staticfiles.urls import staticfiles_urlpatterns urlpatterns = [ path('', views.index, name='kaydol'), path('anasayfa/', views.home, name='anasayfa'), path('duyguanalizi/', views.link1, name='duyguanalizi'), path('duyguanalizi/sonuc', views.sentiment, name='da_sonuc'), path('anahtarkelime/', views.link2, name='anahtarkelime'), path('özetleme/', views.link3, name='özetleme'), path('advarlık/', views.link4, name='advarlık'), path('sorucevap/', views.link5, name='sorucevap'), path('konutanım/', views.link6, name='konutanım'), ] urlpatterns += staticfiles_urlpatterns() html <div class="side_container side_container--fit "> <div class = "item-1"> <form class="" action="{% url 'da_sonuc' %}" method="GET"> <label for="textarea"> <i class="fas fa-pencil-alt prefix"></i> Duygu Analizi </label> <h2>Kendi Metniniz ile Test Edin...</h2> <input class="input" id="textarea" value="{{text}}"> </input> <br> <button type="button" class="btn">Dene</button> </form> <label> Sonuç </label> <div class="outcome"> <p>{{text}}</p> </div> </div> -
REST API with image processing?
This may not be a great question but I am new to API's and REST API's. I understand what API's do, and have a general understanding of REST API's (GET, POST, SET, etc). What I'm confused about is in almost all examples I've seen, the REST API's are database related (query data, update data, insert new data, etc). So I was wondering, if I wanted to create an API where I can send an image, process it in the backend (in Python) and return some image and annotations, is this still considered a REST API, and are there any conventions/advice for this kind of thing? -
Django save image from url and connect with ImageField don't work
I want django automatically download and locally save image from image_url and "connect" it with image_file how Upload image from an URL with Django from django.core.files import File import os class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) avatar = models.ImageField( upload_to=user_directory_path, default='users/avatar.png') bio = models.TextField(max_length=5500, blank=True) fullName = models.CharField(max_length=221, blank=True, default=rand_slug(5) ) dr = models.BooleanField( default=False ) slug = models.SlugField(max_length=250, unique=True, blank=True, default=rand_slug(8)) facebook = models.URLField(max_length=222, blank=True) twitter = models.URLField(max_length=222, blank=True) image_file = models.ImageField(upload_to='images') image_url = models.URLField() def get_remote_image(self): if self.image_url and not self.image_file: result = urllib.urlretrieve(self.image_url) self.image_file.save( os.path.basename(self.image_url), File(open(result[0])) ) self.save() def __str__(self): return self.user.username -
Added a Non-Nullable Field in Django After Creating Entries That Didn't Have That Field; Operational Error, No Such Field
In my models, I added the class Source: class Source(models.Model): profile = models.ForeignKey('Profile', on_delete=models.CASCADE, null=True, default=False, blank=True, related_name='+') project= models.ForeignKey('Project', on_delete=models.CASCADE, null=True, default=False, blank=True, related_name='+') team = models.ForeignKey('Team', on_delete=models.CASCADE, null=True, default=False, blank=True, related_name='+') department = models.ForeignKey('Department', on_delete=models.CASCADE, default=False, blank=True, null=True, related_name='+') def __str__(self): return str(self.id) For testing purposes, I added a few entries for posts in the Django admin page, and then went back into my classes: Post, Profile, Department, Team, and Project, and added: sourceID = models.ForeignKey('Source', default='1', on_delete=models.CASCADE, related_name='+', null=False) for each class. My problem is that when I go in the Django admin page to alter the database (i.e. create a new post) I get the following error: Also, when I go to migrate my changes, I keep getting this warning: HINT: Configure the DEFAULT_AUTO_FIELD setting or the LeadsConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'. I would like to be able to create new entries in my database without the operational error. I've tried changing the null value = True, but this is counterintuitive and doesn't yield any change, surprisingly. I think the best way would be to delete the whole database, which I've tried to research and only found MYSql code solutions. … -
Django generic DeleteView auth
I want to create a post that only the author and the authorities can delete. class PostDeleteView(DeleteView): model = Posts template_name = 'deletepost.html' success_url = '/home' Currently all users can delete posts. -
why does Django Slice works on one page and not the other
This allows me to slice #models.py Class Home(models.Model): house_name = models.CharField(max_length=20, blank=False, null=True) location = models.CharField(max_length=20, blank=False, null=True) rooms = models.CharField(max_length=20, blank=False, null=True) def save(self, *args, **kwargs): self.slug = slugify(self.house_name) super(Home, self).save(*args, **kwargs) #views.py def homes(request): home_model = Home.objects.filter(admin_approval=True) return render(request, 'home/home.html', {'home_model': home_model}) #home.html <div class="container"> <div class="row row-cols-lg-4 row-cols-md-3 text-center text-light"> {% for home in home_model|slice:":10" %} <div class="row-inside-content"> <a href="{% url 'home_detail' home.slug %}"><img src="#"></a> <p><a href="#">{{ home.home_name|title }}</a></p> </div> {% endfor %} </div> Meanwhile if I was to use the same views, and same model and also try to render homes in another page like home/house.html, nothing gets render. I'm utterly confused as to why this is happening. -
Q Filter by alphabet
I attempting to create an alphabet filter in my project that will return all objects that begin with a specific letter. This is my current view class ArtistLetterView(ListView): model = Artist context_object_name = 'artist' template_name = "artist/alpha_list.html" def get_queryset(self): query = self.request.GET.get('q') artist = Artist.objects.filter( Q(stage_name__startswith=query) ) return artist This is my URL path('letter_search/', views.ArtistLetterView.as_view(), name='list_letter'), Currently if I manually enter a path like this http://127.0.0.1:8000/artist/letter_search/?q=D it works. How can I place this functionality into an href? Or am I completely doing this wrong? -
3 way many to many relationship in Django with two inline forms
I'm working on a personal project for educational reasons. I have 3 models (RatePlans, Seasons, RoomRates). Each RatePlan should have multiple Seasons and each Season should have multiple RoomRates. I want to be able to create a RatePlan in the admin panel and then with inlines to create multiple Seasons and also (if it's possible) multiple RoomRates in the same view. How the models should be structured (oneToMany, ManyToMany, do i need a 4th table or how i should do it)? Can i create all of the records in one way in the admin panel (for example to go to RatePlans and start populating the Seasons and the RoomRates at the same time)? Those are my models class RatePlan(models.Model): code = models.CharField(max_length=50, unique=True) name = models.CharField(max_length=50, unique=True) market_segment = models.ForeignKey(MarketSegment, on_delete=models.CASCADE) class Season(models.Model): code = models.CharField(max_length=50, unique=True) name = models.CharField(max_length=50, unique=True) date_from = models.DateField() date_to = models.DateField() class RoomRate(models.Model): code = models.CharField(max_length=50) room_type = models.ForeignKey(RoomType, on_delete=models.CASCADE) charge = models.DecimalField(max_digits=6, decimal_places=2) charge_method = models.ForeignKey(ChargeMethod, on_delete=models.CASCADE) Thanks in advance -
Programming Error in deploying Django website on Heroku
I am learning Django and wanted to deploy the app on Heroku. upon following the Heroku documentation on deploying the app to the platform. It is throwing errors. I have 2 apps in the project: blog (for writing the blogs) userAuthentication (user auth) Please help! ERROR on Heroku deployed app: ProgrammingError at / relation "blog_categories" does not exist LINE 1: ...categories"."name", "blog_categories"."name" FROM "blog_cate... ^ Request Method: GET Request URL: https://sciencecreed.herokuapp.com/ Django Version: 3.2 Exception Type: ProgrammingError Exception Value: relation "blog_categories" does not exist LINE 1: ...categories"."name", "blog_categories"."name" FROM "blog_cate... ^ Exception Location: /app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py, line 84, in _execute Python Executable: /app/.heroku/python/bin/python Python Version: 3.9.4 Python Path: ['/app/.heroku/python/bin', '/app', '/app/.heroku/python/lib/python39.zip', '/app/.heroku/python/lib/python3.9', '/app/.heroku/python/lib/python3.9/lib-dynload', '/app/.heroku/python/lib/python3.9/site-packages'] Server time: Thu, 29 Apr 2021 21:36:58 +0000 ERROR on executing "heroku logs" I believe all this will help in assisting. -
"Authentication credentials were not provided": how can I make all the views to require log in in DRF?
I'm trying to restrict the post view to only those who have logged in, however after I added the permission to only 'IsAuthenticated' I get this when I go to the url: { "detail": "Authentication credentials were not provided." } Of course, when I go there I have already logged in so something is not working but I'm not sure what. How can I make it so that users can see the posts only if the logged in? This is the view of the post and the log in: class UserLoginAPIView(generics.CreateAPIView): permission_classes = (permissions.AllowAny, ) serializer_class = serializers.UserLoginSerializer def post(self, request, *args, **kwargs): serializer = UserLoginSerializer(data=request.data, context={'request': request}) serializer.is_valid(raise_exception=True) user = serializer.validated_data['user'] token, created = Token.objects.get_or_create(user=user) return Response({"status": status.HTTP_200_OK, "Token": token.key}) class PostAPIView(generics.ListCreateAPIView): """PostViewSet Post API will be used to creating new discussion, listing, and replying to a post """ queryset = Post.objects.all() serializer_class = PostSerializer permission_classes = (IsAuthenticated,) def pre_save(self, obj): obj.created_by = self.request.user def get_queryset(self): """ """ return Post.objects.filter(reply_to__isnull=True) def get(self, request, format=None): content = { 'user': str(request.user), # `django.contrib.auth.User` instance. 'auth': str(request.auth), # None } return Response(content) The URL: urlpatterns = [ path('login/', views.UserLoginAPIView.as_view(), name='login'), path('post/', views.PostAPIView.as_view(), name='post'), ] I have these in my settings: REST_FRAMEWORK = … -
Heroku refused connection error 111 for xhtml2pdf to work in Heroku
I have a Django app, with a postgresql database and I have been using xhtml2pdf to render some pdfs. Everything works in production mode but when I deployed to Heroku, the pdf function is not working. I'm guessing it's something to do with BytesIO but I'm stumped. I'm using this code: def print_release(self, request, queryset): print(queryset) queryset=queryset.all().order_by('customer') files =[] for q in queryset.all(): customer=q.customer order=Order.objects.get(customer=customer) firstname = q.customer.first_name lastname = q.customer.last_name data = {'order':order,'firstname': firstname, 'lastname': lastname, } if order.customer.staff_participant =="Participant": pdf=admin_render_to_pdf('accounts/release_pdf_template.html', data) files.append(("Participant "+lastname + "_" +"_release" + ".pdf", pdf)) else: pdf=admin_render_to_pdf('accounts/release_pdf_template.html', data) files.append(("Staff "+lastname + "_" +"_release" + ".pdf", pdf)) full_zip_in_mewmory = generate_zip(files) response = HttpResponse(full_zip_in_mewmory, content_type='application/force-download') download_name = "Releaseforms_" + ".zip" response['Content-Disposition'] = 'attachment; filename="{}"'.format(download_name) return response def generate_zip(files): mem_zip = BytesIO() with zipfile.ZipFile(mem_zip, mode = "w", compression=zipfile.ZIP_DEFLATED) as zf: for f in files: zf.writestr(f[0], f[1]) return mem_zip.getvalue() and get these errors: Environment: Request Method: POST Request URL: https://****** Django Version: 3.1.5 Python Version: 3.9.4 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'accounts.apps.AccountsConfig', 'django_filters'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware'] Traceback (most recent call last): File "/app/.heroku/python/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/app/.heroku/python/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response response = … -
Formatting multiple BooleanFields as a single Select widget
The database im working with has several boolean fields where only ever one of them should be true at a time. I want to format these as a Select widget, so that I can list the choices and False will be returned for all of the boolean fields except for the selected option. I got each of them individually working as checkboxes (I commented those out), and I was able to make a select widget that is displaying correctly in the view (client_type), but I cannot accomplish the above. Here's the relevant section of my models.py: class DomCase(models.Model): plaintiff = models.BooleanField(default=False, blank=True) defendant = models.BooleanField(default=False, blank=True) class DomCaseForm(ModelForm): client_type = ChoiceField(choices=(('', '----'),('plaintiff', 'Plaintiff'),('defendant','Defendant')), widget=Select(attrs={'class': 'form-control', 'id': 'client_type'})) class Meta: model = DomCase widgets = { #'plaintiff': CheckboxInput(attrs={'class': 'custom-control-input', }), #'defendant': CheckboxInput(attrs={'class': 'custom-control-input', }), } # Dynamically Create Form Fields based on widget details fields = [] for widget in widgets: fields.append(widget) fields = tuple(fields) -
Filtering a django Prefetch based on more fields from the root object
This is similar to other questions regarding complicated prefetches but seems to be slightly different. Here are some example models: class Author(Model): pass class Book(Model): authors = ManyToManyField(Author, through='BookAuthor') class BookAuthor(Model): book = ForeignKey(Book, ...) author = ForeignKey(Author, ...) class Event(Model): book = ForeignKey(Book, ...) author = ForeignKey(Author, ...) In summary: a BookAuthor links a book to one of its authors, and an Event also concerns a book and one of its authors (the latter constraint is unimportant). One could design the relationships differently but it's too late for that now, and in my case, this in fact is part of migrating away from the current setup. Now suppose I have a BookAuthor instance and want to find any events that relate to that combination of book and author. I can follow either the book or author relations on BookAuthor and their event_set reverse relationship, but neither gives me what I want and, if I have several BookAuthors it becomes a pain. It seems that the way to get an entire queryset "annotated" onto a model instance is via prefetch_related but as far as I can tell there is no way, in the Prefetch object's queryset property, to refer to … -
Need help understand the message from upgrading Django
Can someone help me understand what I need to do in response to this error message--or whether anything needs to be done at all? This happened when I decided to upgrade Django from 3.1x to 3.2 (no need to delve into the reasons--a learner's mistakes). I followed the official instructions to test for dependency issues, $ python -Wa manage.py test, and nothing showed up. Then python -m pip install -U Django yielded the following long message. The last line declares Successfully installed Django-3.2 asgiref-3.3.4, but why the long message. python3 -m pip install -U Django WARNING: Value for scheme.headers does not match. Please report this to <https://github.com/pypa/pip/issues/9617> distutils: /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/UNKNOWN sysconfig: /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 WARNING: Additional context: user = False home = None root = None prefix = None Requirement already satisfied: Django in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (3.1.7) Collecting Django Using cached Django-3.2-py3-none-any.whl (7.9 MB) Requirement already satisfied: sqlparse>=0.2.2 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from Django) (0.4.1) Collecting asgiref<4,>=3.3.2 Using cached asgiref-3.3.4-py3-none-any.whl (22 kB) Requirement already satisfied: pytz in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from Django) (2020.5) Installing collected packages: asgiref, Django Attempting uninstall: asgiref Found existing installation: asgiref 3.3.1 Uninstalling asgiref-3.3.1: Successfully uninstalled asgiref-3.3.1 Attempting uninstall: Django Found existing installation: Django 3.1.7 Uninstalling Django-3.1.7: Successfully uninstalled Django-3.1.7 WARNING: Value for scheme.headers … -
this model register the first item and leave the rest of the items
if user ordered multiple items, the model only register the first item. the model: class OrderItem(models.Model): order = models.ForeignKey(Order, related_name='items', on_delete=models.CASCADE) item = models.ForeignKey(Item, related_name='order_items', on_delete=models.CASCADE) price = models.DecimalField(max_digits=10, decimal_places=2) quantity = models.PositiveIntegerField(default=1) def __str__(self): return str(self.id) def get_cost(self): return self.price * self.quantity -
How to set up Django permissions for a custom user?
Good evening! I have the following, a table containing my custom users (our dear Fellows) which will serve to login our users (by using the custom model). ◢ The custom backends with it's custom user model for the Fellows table. from django.contrib.auth.hashers import check_password from django.contrib.auth.models import User from .models import CustomUser class FellowBackend: def authenticate(self, request, **kwargs): '''Authenticates the user (custom model).''' # Parameters user_id = kwargs['username'] password = kwargs['password'] # Tentatives. try: user = CustomUser.objects.get(id = user_id) # If the password matches. if check_password(password, user.password): return user else: # Triggers default login failed. return None except CustomUser.DoesNotExist: return None def get_user(self, user_id): '''TODO: Test if this override is required.''' try: return CustomUser.objects.get(pk = user_id) except CustomUser.DoesNotExist: return None ◢ The custom user model. class Faction(models.Model): id = models.AutoField(db_column='ID', primary_key=True) # Field name made lowercase. name = models.CharField(db_column='Name', max_length=64) # Field name made lowercase. class Meta: managed = False db_table = 'Faction' class CustomUser(AbstractBaseUser): id = models.PositiveBigIntegerField(db_column='ID', primary_key=True) # ID. display_name = models.CharField(db_column='Name', max_length=64, db_collation='utf8mb4_general_ci') password = models.CharField(db_column='User_Password', max_length=256, blank=True, null=True) gold = models.IntegerField(db_column='Gold') # Credits. faction = models.ForeignKey('Faction', models.RESTRICT, db_column='Faction', default=1) # ID Faction. last_login = models.DateTimeField(db_column='Last_Login', blank=True, null=True) # Last Login. # Admin Panel Abstract Fields active … -
Pass 2 values to validator
In Django I try in forms create validator with compare password and confirm_password and I don't want do it in clean method. I want my do cystom validator and put him to widget confirm_password field. I don't know ho pass two values password and confirm_password to my Validator. def validate_test(): cleaned_data = super(UserSignUpForm, self).clean() password = cleaned_data.get("password") confirm_password = cleaned_data.get("confirm_password") print(f'password:{password}\nconfirm_password: {confirm_password}') if password != confirm_password: raise ValidationError( _('%(password)s and %(confirm_password)s does not match - test'), params={'password': password, 'confirm_password': confirm_password}, ) class UserSignUpForm(forms.ModelForm): password = forms.CharField( label="Password", validators=[MinLengthValidator(8, message="Zbyt krótkie hasło, min. 8 znaków")], widget=forms.PasswordInput(attrs={'style':'max-width: 20em; margin:auto', 'autocomplete':'off'})) confirm_password = forms.CharField( label="Confirm password", validators=[MinLengthValidator(8, message="Zbyt krótkie hasło, min. 8 znaków"), validate_test()], widget=forms.PasswordInput(attrs={'style':'max-width: 20em; margin:auto', 'autocomplete':'off'})) class Meta: model = User fields = ("username", 'first_name', 'last_name', "password") help_texts = {"username": None} widgets = { 'username': forms.TextInput(attrs={'style':'max-width: 20em; margin:auto'}), 'first_name': forms.TextInput(attrs={'style':'max-width: 20em; margin:auto'}), 'last_name': forms.TextInput(attrs={'style':'max-width: 20em; margin:auto'}), } -
Django guardian with million of records
I want to build ERP system (You are know that ERP Systems have 200-300 tables and more in database) so I want some advice about django guardian with huge number of records. I look for django guardian documentations I found that all objects permission for every table recorde store in single table with Indexes. Could I force problems If I use it to manage records permissions? -
Django unable to locate modules
I set up a Django project using pipenv and have the virtual environment running using pipenv shell. I have been trying to add a few modules to my project including django-acl. However, whenever I $ pipenv install django-acl and then attempt to migrate I get the following message. ModuleNotFoundError: No module named 'djangoacl' At first I thought that django-acl just didn't work but it's done this same thing with every module that I've tried to add since. How do I fix this so that I can add django-acl and other modules to my project? -
Django query from multi PostgreSQL Schema
I want to know the following about multi PostgreSQL schema in Django: Is the query from non public schema required to establish connection or not. How to query from other Schema using Django "Using()" method. Is eligible in Django to make one database with multi schema. I was searching about that topic a lot of programmers make duplicated for single database in Django settings and change only option for each one. -
Module missing when deploying on Heroku
I'm trying to deploy a Django app with React frontend on Heroku but it keeps getting stuck at the error message "ModuleNotFoundError: No module named 'corsheaders'". I have corsheaders in my requirements.txt as django-cors-headers==3.7.0 and I have it in installed apps in settings.py as INSTALLED_APPS = ['corsheaders', ...] I also have it installed on the venv I'm using for this project. While running my app in heroku local everything is chill. What could be the problem here? -
DAL ( Django Autocomplete Light ) - How to open the select on page load
Trying to open the select2 on page load using document.ready doesn't work because "autocomplete_light.js initialize function" is tied to same event and at document.ready, the componente isn't initialized yet. How can I open the select2 after it has been initialized by autocomplete light?