Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to make a scheduled celery task that starts multiple jobs with different params?
I have a celery task like: # Inside tasks.py from .models import Animal @shared_task def process_animals(): animals = Animal.ojbects.filter(age=5) for animal in animals: utils.register_animal(animal) I have a schedule like: # Inside celery.py from celery import Celery from celery.schedules import crontab app = Celery("core") app.conf.beat_schedule = { "runs-every-1-min": { "task": "my_app.core.tasks.process_animals", "schedule": crontab(), }, } There is no reason to process the Animals one at a time, they're all independent. Is it possible to "multiprocess" or "multi-task" this list? -
testdriven.io: The Definitive Guide to Celery and Django. All containers logs are "Waiting for PostgreSQL to become available..."
I've followed each step of part 1 chapter 4 and literally copy pasted the code as shown. docker-compose is able to build the containers but I always get the Waiting for PostgresSQL to become available being logged from all the other containers as shown below. docker-compose logs Following is the output of docker ps -a. From which I can see that all containers are running in their respective ports. docker ps -a logs I checked the docker container logs of the db and it shows to be running. postgres container logs But, I'm unable to open the Django server on port 8010 nor able to view the flower server on port 5557 because in the container logs I'm getting the message "Waiting for PostgreSQL to become available..." Someone please help. This issue is killing me. I've tried to view the logs of each container and it's showing it's running, yet I'm not able to view the Django and flower server. Let me know if you guys need more info. Thanks! Tried checking if the DB is up and running at the correct port. checked if Redis is running. checked the logs of each running container which points to the same … -
Django Crispy Form doesn't add or update database
Hello, I am writing a small project about a car shop and this is the problem I came up with. I'm trying to add a new car and everything seems to work, but when I fill out the form and click submit, it just redirects me to products page without errors and without adding a new car to the database. Here is the code. views.py class AddProductView(View): action = 'Add' template_name = 'myApp/manipulate_product.html' context = { } form_class = ManipulateProductForm def get(self, req, *args, **kwargs): form = self.form_class() self.context['action'] = self.action self.context['form'] = form return render(req, self.template_name, self.context) def post(self, req, *args, **kwargs): form = self.form_class(req.POST or None) if form.is_valid(): form.save() else: print(form.errors) return redirect('products', permanent=True) models.py class Car(models.Model): name = models.CharField(max_length=32) model = models.CharField(max_length=32, unique=True) price = models.IntegerField(validators=[ MinValueValidator(0), ]) def __str__(self): return f'{self.name} {self.model}' forms.py class ManipulateProductForm(forms.ModelForm): def __init__(self, action="Submit", *args, **kwargs): super().__init__(*args, **kwargs) self.action = action self.helper = FormHelper(self) self.helper.add_input(Submit('submit', self.action, css_class='btn btn-primary')) class Meta: model = Car fields = '__all__' manipulate_product.html {% extends 'base.html' %} {% load static %} {% load crispy_forms_tags %} {% block content %} <div class="product-manipulate-container"> {% crispy form form.helper%} </div> {% endblock %} I'm sure the problem is in Crispy, because if … -
Django: One-to-Many and Many-to-One Serializers and Queries
I have a relationship similar to this: One city has one-to-many buildings; one building has zero-to-many devices. The user must be able to request a city by its PK, receiving in response the city, the buildings in the city, and the devices in those buildings. I know that foreign keys are necessary in creating the models, like this: class City(models.Model): #Columns here class Building(models.Model): cityId = models.ForeignKey(City, on_delete=models.CASCADE) #Columns here class Device(models.Model): buildingId = models.ForeignKey(Building, on_delete=models.CASCADE) #Columns here What I'm having trouble with is how to write the serializers and the queries. As of now, my serializers only include fields corresponding to that table's columns: class CitySerializer(serializers.ModelSerializer): class Meta: model = City fields = ['id', ...] class BuildingSerializer(serializers.ModelSerializer): class Meta: model = Building fields = ['id', 'cityId', ...] class DeviceSerializer(serializers.ModelSerializer): class Meta: model = Device fields = ['id', 'buildingId', ...] However, when I have to respond to a GET request for the city, I only know how to use a nested for loops to get the building and device data after finding the city by the inputted ID. I presume there's a better way, but I'm having trouble finding clear answers online. -
Django admin site user password change
Django admin site used to have a form to change the password for a user that wasn't the logged in user. You would look at the user's update page, and by the password field, there was a change password link. You would click it, and it would take you to a different page for changing the password. I used to take advantage of that page to allow changing of a user's password, without having to open the admin. In Django 4, it seems to now be missing. In fact, I can't figure out how one would change a user's password other than their own, without writing my own view. I have 2 questions: Is there a way in the admin site now to change a different user's password? If this view is gone, what is now the best way for a superuser to have a view that can change passwords for a user? -
How to integrate a VueJS (made using vite) project with a Django project?
I cannot find a stackoverflow post regarding this. How can a login/authentication system created as part of a django project take a user to a vue front end project once authenticated/user is logged in? -
How to show category names in the dropdown list of django form
I am working on a article management platform webapp using django. I have created a registration form using the django form where I want to show category names from the category table. This is the code to create category table where I have two column. One is cid which is ID and another one is category_name. Here the category name will be for example: Technology, Software engineering, Medicine etc. blog.models.py from django.db import models # Create your models here. class Category(models.Model): cid = models.AutoField(primary_key=True, blank=True) category_name = models.CharField(max_length=100) def __str__(self): return self.category_name The cid is a foreign key for users table because each user must select a category name from the specialization field to register an account in this app. As I am using built-in user model, so I have added the cid as a foreign key in the user table as given below. users/model.py from django.db import models from blog.models import Category from django.contrib.auth.models import AbstractUser # Create your models here. class CustomUser(AbstractUser): cid = models.ForeignKey(Category, on_delete=models.CASCADE) in the forms.py file I have added the email and specialization field to display them in the registration form like below. However, I am not sure if the category code part is … -
Django site social authentication ERROR | Facebook OAuth - URL blocked error
I am working on a Django web application in which I have to implement social authentication using Facebook (reference - Django 4 By Example). I have installed the required python packages social_django, django_extensions and I am operating the website on https as mentioned in the book. Edited the hosts file of my machine to serve domain name of my choice, in ALLOWED_HOSTS setting added the domain name. I have created the app using Facebook's developers account and have kept the settings as mentioned in the book and added domain name in the required field. In main app's urls.py I have added a path social_auth. I have added the redirect url in Valid OAuth Redirect URIs field. The site is running perfectly on https with custom domain name, but I am getting this error - URL blocked: This redirect failed because the redirect URI is not whitelisted in the app's client OAuth settings. Make sure that the client and web OAuth logins are on and add all your app domains as valid OAuth redirect URIs. I hope the reader understands my problem I have tried to keep it as simple as possible, I am following Django 4 By Example Chapter 5. … -
Django throws Unique constraint failed IntegrityError with OneToOneField. Why?
I have two models, CaracteristiquesGenerales and DataBetweenViews. class CaracteristiquesGenerales(models.Model): utilisateur = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) # some other fields ... (no field relating to another model) class DataBetweenViews(models.Model): caracteristiques_generales = models.OneToOneField(CaracteristiquesGenerales,on_delete=models.CASCADE) # some other fields ... (no field relating to another model) And I have a post_save signal. @receiver(post_save, sender=CaracteristiquesGenerales) def etape_1_ok(sender, instance, *args, **kwargs): data_between_views, created = DataBetweenViews.objects.get_or_create(caracteristiques_generales=instance) data_between_views.etape_1 = True data_between_views.save() Because of the signal, Django throws django.db.utils.IntegrityError: UNIQUE constraint failed: general_databetweenviews.caracteristiques_generales_id. I have also tried this : @receiver(post_save, sender=CaracteristiquesGenerales) def etape_1_ok(sender, instance, *args, **kwargs): try: data_between_views = DataBetweenViews.objects.get(caracteristiques_generales=instance) data_between_views.etape_1 = True data_between_views.save() except DataBetweenViews.DoesNotExist: data_between_views = DataBetweenViews.objects.create(caracteristiques_generales=instance) data_between_views.etape_1 = True data_between_views.save() Why is Django not able to create a new DataBetweenViews object since it cannot find it ? -
python sql table with paramter to json
Good Day! I am trying to conver sql query into json with python, but getting an error when try to use sql query with a paramater: sql syntax error: incorrect syntax near "%" it works ok without setting paramater my code def db(db_name="xxx"): return dbapi.connect(address=db_name, port="xx", user="xx", password="123") def query_db(query, args=(), one=False): cur = db().cursor() cur.execute(query, args) r = [dict((cur.description[i][0], value) for i, value in enumerate(row)) for row in cur.fetchall()] cur.connection.close() return (r[0] if r else None) if one else r def test(request): my_query = query_db("select bname, name_text from addrs where num=%s", (100,)) return JsonResponse(my_query, safe=False) urlpatterns = [ path('s4d/', test), ] thanks -
Trouble with heroku logs
When I try opening my app on HerokuHeroku Logs I get an error. Im still new to coding so I'm, not the best at reading what the error means. I have Been trying to go over my code and see what's wrong but I can really see anything obvious... Any pointers I was hoping for the app to launch without any trouble. -
Django - How do you create several model instances at the same time because they are connected
I want to create a user profile and the user profile has a location (address). I need to create the profile first and location second, and then match the profile and the location using a third model called ProfileLocation. I want to do this using one api call, because all the data comes from one form and the location depends on the profile. There is a location model that has OneToOne fields for Country, State and City. The countries, states and cities will have the database tables populated before the time. There is an extra model called ProfileLocation that links the profile to the location. So I have to create all of them at once and struggling with what the best way to do it is. Also what type of DRF view do I use for the endpoint? I need to understand the logic please and I cannot find an example on the net. Do I need to create a custom function based view and run the data through the existing serializers? In that case how can I bundle the incoming data for each specific serializer? This is all very new to me Locations model.py: from django.db import models from … -
Websocket connection not working in Django Channels ('WebSocket connection to 'ws://localhost:8000/ws/board/7/' failed:')
I'm trying to get a websocket running for a Django project I'm working on, but I can't get the websocket to connect, which is strange since I copied the example chat application from. the channels documentation and that worked fine but when I copy-pasted that same code over to my project, it didn't. So, here are the relevant sections of code: the relevant view in views.py def board_view(request, key): board = get_object_or_404(request.user.boards, pk=key) key = dumps(board.pk) return render(request, 'core/board.html', {"board":board, "permission":user_permission, "key":key}) board.html (the relevant part) <script> const key = JSON.parse("{{key|escapejs}}"); const chatSocket = new WebSocket( 'ws://' + window.location.host + '/ws/board/' + key + '/' ); routing.py from django.urls import re_path from . import consumers websocket_urlpatterns = [ re_path(r"^ws/board/(?P<key>\d+)/$", consumers.ChatConsumer.as_asgi()), ] consumers.py import json from channels.generic.websocket import WebsocketConsumer class ChatConsumer(WebsocketConsumer): def connect(self): self.accept() self.send(text_data=json.dumps({ 'type':'connection_established', 'message':'you are now connected' })) def disconnect(self, close_code): pass def receive(self, text_data): text_data_json = json.loads(text_data) message = text_data_json["message"] self.send(text_data=json.dumps({"message": message})) asgi.py import os from channels.auth import AuthMiddlewareStack from channels.routing import ProtocolTypeRouter, URLRouter from channels.security.websocket import AllowedHostsOriginValidator from django.core.asgi import get_asgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sketchboard.settings') django_asgi_app = get_asgi_application() import core.routing application = ProtocolTypeRouter({ "http": django_asgi_app, "websocket": AllowedHostsOriginValidator( AuthMiddlewareStack(URLRouter(core.routing.websocket_urlpatterns)) ), }) settings.py (relevant part): ASGI_APPLICATION = 'sketchboard.asgi.application' and INSTALLED_MY_APPS … -
django rest framework translation does not work for me
I tried django rest framework internationalization. doc drf internationalization From official drf documentation a set this code in settings.py from django.utils.translation import gettext_lazy as _ MIDDLEWARE = [ ... 'django.middleware.locale.LocaleMiddleware' ] LANGUAGE_CODE = "it" LANGUAGES = ( ('en', _('English')), ('it', _('Italian')), ('fr', _('French')), ('es', _('Spanish')), ) TIME_ZONE = 'UTC' USE_I18N = True but when I try out POST api rest curl -X 'POST' \ 'http://172.18.0.1:7000/appjud/api/v1/reset-password/' \ -H 'accept: application/json' \ -H 'Authorization: Token 014cb7982f31767a8ce07c9f216653d4674baeaf' \ -H 'Content-Type: application/json' \ -d '{ "new_password": "", "confirm_password": "" }' Response body [ { "newpassword": [ "This field is required." ], "confirmpassword": [ "This field is required." ] } ] Response headers allow: POST,OPTIONS content-language: en content-length: 91 content-type: application/json cross-origin-opener-policy: same-origin date: Sat,03 Dec 2022 16:14:16 GMT referrer-policy: same-origin server: WSGIServer/0.2 CPython/3.9.15 vary: Accept,Accept-Language,Origin x-content-type-options: nosniff x-frame-options: DENY As we can see it print "This field is required." but I would like "Questo campo è obbligatorio." What Does I miss in config settings.py file? -
How to redirect an authenticated (using Django) user to VueJS frontend?
I have a simple VueJS setup that involves some use of a router. This runs on one server. I also have a django backend project that runs on a second server. I would like for a django view to take my user to my vue frontend. What approach could I take to reach this? I have not yet made an attempt but if there is a specific part of my code I would need to show to get support then do let me know. I have consider the below SO post however it does not address my issue relating to what a view function would need to consist of. Setup django social auth with vuejs frontend -
Django Framework Not Picking Up Custom CSS
I am using Django Framework for my blog, however when I am trying to style my webpage, the classes are not being picked up. These are the images of my div with latest-articles class: As you can see from the next image, the HTML recognises the class as display: block; However, my CSS clearly states that it is of display: block; This is my CSS code: .latest-articles { /* dont think this class is being picked up */ display: flex; flex-wrap: wrap; flex-direction: row; justify-content: center; align-items: center; padding-top: 0; text-align: center; position: relative; padding: 10px; } Other CSS changes I have made previously have worked so I am unsure as to why this does not work. Any additional information can be provided, and any help is greatly appreciated. -
Doubt_on_django _json_data
How to pass emp.json file data into django database? I tried that how to dump data for django database to .json file and I am expecting clear step by step answer for my question i.e, How to pass emp.json file data into django database? -
My Query set is returning empty List even there are users in the db
Below listed are my Model, View, and Serializer classes. I am making a admin dashboard where admin can create users, list them, and search a user by ID. Users are being created successfully but the GET request for listing & searching returns an empty list even where there are users present in the Database. My Model Classes: class MyAccountManager(BaseUserManager): def create_user(self,email,username,first_name,last_name, age, password=None): if not email: raise ValueError("Users must have email address") if not username: raise ValueError("Users must have username") user = self.model( email=self.normalize_email(email), username=username, first_name=first_name, last_name=last_name, age=age, ) user.set_password(password) user.save(using=self._db) return user def create_superuser(self,username,email,first_name,last_name,age,password): user = self.create_user( email=self.normalize_email(email), username=username, first_name=first_name, last_name=last_name, age=age,) user.is_admin = True user.is_staff = True user.is_superuser = True user.save(using=self._db) return user class User(AbstractBaseUser): email = models.EmailField(verbose_name="email",max_length=60,unique=True) username = models.CharField(max_length=30,unique=True) date_joined = models.DateTimeField(verbose_name='date joined',auto_now_add=True) last_login = models.DateTimeField(verbose_name='last login',auto_now=True) is_admin = models.BooleanField(default=False) is_active = models.BooleanField(default=False) is_staff = models.BooleanField(default=False) is_superuser = models.BooleanField(default=False) first_name = models.CharField (max_length=60) last_name = models.CharField(max_length=60) age = models.DateField(default=datetime.date.today) profile_pic = models.ImageField(upload_to='image',blank=True,null=True) USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['username','first_name','last_name','age'] objects = MyAccountManager() def __str__(self): return self.username + "," +self.email def has_perm(self, perm, obj=None): return self.is_admin def has_module_perms(self, app_label): return True My Serializer Class: class UserSerializer (serializers.ModelSerializer): class Meta: model = User fields = ['username','first_name','last_name','email','age','is_active'] read_only_fields = ('email',) … -
Django registration form gives error, when password can not pass validation
I am trying to make user refistration, with automaticaly login. And it works. But when passwords are different, or do not pass validation, there is no message from the form, it throws error: AttributeError at /accounts/register/ 'AnonymousUser' object has no attribute '_meta' I think the error comes from the login(request, self.object) line. But I am not sure what to do, so it works as needed. Thank you in advance. I hope someone can help me. my model: class AppUser(auth_models.AbstractBaseUser, auth_models.PermissionsMixin): email = models.EmailField( unique=True, blank=False, null=False, ) is_staff = models.BooleanField( default=False, blank=False, null=False, ) USERNAME_FIELD = 'email' objects = AppUserManager() my form: class SignUpForm(auth_forms.UserCreationForm): class Meta: model = UserModel fields = (UserModel.USERNAME_FIELD, 'password1', 'password2',) field_classes = { 'email': auth_forms.UsernameField, } my view: class SignUpView(views.CreateView): template_name = 'accounts/user/register-user-page.html' form_class = SignUpForm success_url = reverse_lazy('home') def post(self, request, *args, **kwargs): response = super().post(request, *args, **kwargs) login(request, self.object) return response I have tried to fix the problem with overriding the clean() method in the form, but it did not work. -
Adding help text to a django from
I want to add help text/tool tip when a user hovers over a form field. I have a model form based on this model: class MyModel(TimeStampedModel): MY_CHOICES = [tuple([x,x]) for x in range(1,8)] p1 = models.IntegerField("P1”, default='1', help_text=‘text1’) p2 = models.IntegerField(“P2”, default=‘1’, , help_text=‘text2’) Parent = models.ForeignKey(ParentModel, on_delete=models.CASCADE) The form itself looks like: class MyModelForm(ModelForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.form_id = 'id-CaseForm' self.helper.form_class = 'blueForms' self.helper.form_method = 'post' self.helper.form_tag = False self.helper.help_text_inline = False self.helper.form_show_labels = False self.helper.layout = Layout( Row(Field(PrependedText('p1', ‘field_label1’, wrapper_class='col-12 col-lg-6 pe-0 stretchprepend'))), Row(Field(PrependedText('p2’, ‘field_label2’, wrapper_class='col-12 col-lg-6 pe-0 stretchprepend’)))) CHOICES = [tuple([x,x]) for x in range(1,8)] p1 = IntegerField( label='field_label1', widget=Select(choices=CHOICES)) p2 = IntegerField( label='field_label2’, widget=Select(choices=CHOICES)) class Meta: model = MyModel fields = ['p1', 'p2’,] And this is displayed as a crispy form in the template: {% crispy MyModelForm %} I want the user to see some help text when they hover over the fields. This help text could be the help_text from the model, or I am happy to put it somewhere else (although it should go in either the model or the form, not in the template). Any help appreciated. -
How should queryset be set for related fields
I have two models named book and chapter. each book can have many chapters, so models are like: class Book(models.Model): title = models.CharField(max_length=100) class Chapter(models.Model): title = models.CharField(max_length=100) book = models.ForeignKey("books.Book", on_delete=models.CASCADE) and serializers are like: class BookSerializer(serializers.ModelSerializer): class Meta: model = Book fields = ["title"] class ChapterSerializer(serializers.ModelSerializer): book = serializers.PrimaryKeyRelatedField(queryset=Book.objects.all()) class Meta: model = Chapter fields = ["title", "chapter_number", "text", "book"] So my question is here: Is it OK to set queryset=Book.objects.all()) for related field? I mean, if the number of books gets bigger, wouldn't be any problem to query all the books to set the right book? -
How to return value from api in function Django
Does anyone know how I can return the value of the api in this function, so I can use this value to save in the database. def cart_sessionid(request): url = f"https://ws.sandbox.pagseguro.uol.com.br/v2/sessions?email={email}&token={token}" payload = "" headers = {} response = requests.request("POST", url, headers=headers, data=payload) return response.text I need to be able to call the cart_sessionid function this way with the value that the api is returning: cart = Cart.objects.create(cart_id=cart_sessionid(request)) I tried that way but it didn't work. -
Django acting weird on Windows server IIS deployment
I have the following view which allows me to save the information of a multi step application. def saveNewApplication(request, *args, **kwargs): educationList = [ val for val in pickle.loads(bytes.fromhex(request.session['education'])).values() ] basicInfoDict = pickle.loads(bytes.fromhex(request.session['basic_info'])) documentsDict = pickle.loads(bytes.fromhex(request.session['documents'])) applicant, created = ApplicantInfo.objects.update_or_create( applicantId=request.session['applicantId'], defaults={**basicInfoDict} ) if created: #saving the diplomas for education in educationList: Education.objects.create(applicant=applicant, **education) with open(f"{documentsDict['cv_url']}/{request.session['file_name']}", 'rb') as f: Documents.objects.create( applicant=applicant, cv =File(f, name=os.path.basename(f.name)), langue_de_travail = documentsDict['langue_de_travail'] ) #remove the temporary folder shutil.rmtree(f"{documentsDict['cv_url']}") else: educationFilter = Education.objects.filter(applicant=applicant.id) for idx, edu in enumerate(educationFilter): Education.objects.filter(pk=edu.pk).update(**educationList[idx]) #updating the documents document = get_object_or_404(Documents, applicant=applicant.id) if documentsDict['cv_url']: with open(f"{documentsDict['cv_url']}/{request.session['file_name']}", 'rb') as f: document.cv = File(f, name=os.path.basename(f.name)) document.save() document.langue_de_travail = documentsDict['langue_de_travail'] document.save() languagesDict = pickle.loads(bytes.fromhex(request.session['languages'])) Languages.objects.update_or_create(applicant=applicant, defaults={**languagesDict}) if 'experiences' in request.session and request.session['experiences']: experiencesList = [ pickle.loads(bytes.fromhex(val)) for val in request.session['experiences'].values() ] Experience.objects.filter(applicant=applicant.id).delete() for experience in experiencesList: Experience.objects.create(applicant=applicant, **experience) return JsonResponse({'success': True}) In the development it works perfectly but if deployed I am getting a 404 raise by this line get_object_or_404(Documents, applicant=applicant.id) meaning the creating is false. and I can't figure why is that. The weirdest thing is if I do comment the entire else block it also returns a 500 error but this time it I do click in the link of the console it … -
I want to run migration from PostgreSQL to sqlite3
currently I am using PostgreSQL database in my project but I also want to use SQLite for localhost, so I want to run migrate command but there are errors because in SQLite array field is not used so I want to convert array field to JSONfield and makemigrations but in migrations old migrations also present. S I want to write custom logic in migrations. So, it use old migrations when database is PostgreSQL and new migrations when it is sqlite3. I don't want create new migrations and migration table every time I switch databases. -
OSError: cannot load library 'gobject-2.0-0' when deploying to railway
I keep getting this error when I want to deploy to railway from . import views File "/app/account/views.py", line 2, in <module> from weasyprint import HTML, CSS File "/opt/venv/lib/python3.10/site-packages/weasyprint/__init__.py", line 336, in <module> from .css import preprocess_stylesheet # noqa isort:skip File "/opt/venv/lib/python3.10/site-packages/weasyprint/css/__init__.py", line 25, in <module> from . import computed_values, counters, media_queries File "/opt/venv/lib/python3.10/site-packages/weasyprint/css/computed_values.py", line 9, in <module> from ..text.ffi import ffi, pango, units_to_double File "/opt/venv/lib/python3.10/site-packages/weasyprint/text/ffi.py", line 398, in <module> gobject = _dlopen( File "/opt/venv/lib/python3.10/site-packages/weasyprint/text/ffi.py", line 385, in _dlopen return ffi.dlopen(names[0]) # pragma: no cover File "/opt/venv/lib/python3.10/site-packages/cffi/api.py", line 150, in dlopen lib, function_cache = _make_ffi_library(self, name, flags) File "/opt/venv/lib/python3.10/site-packages/cffi/api.py", line 832, in _make_ffi_library backendlib = _load_backend_lib(backend, libname, flags) File "/opt/venv/lib/python3.10/site-packages/cffi/api.py", line 827, in _load_backend_lib raise OSError(msg) OSError: cannot load library 'gobject-2.0-0': gobject-2.0-0: cannot open shared object file: No such file or directory. Additionally, ctypes.util.find_library() did not manage to locate a library called 'gobject-2.0-0' It works perfectly on my localhost and also in heroku when I first deployed to heroku. But now, I want to migrate to railway due to the end of heroku's free service but that error keeps coming.