Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Can't properly runserver/ project structure incorrect?
I'm attempting to build a small project for myself. It's a trip planner. I'm working primarily with django/python combination and can't seem to find the issue. In particular I'm getting this error when I'm going to run server in powershell; django.core.exceptions.ImproperlyConfigured: Cannot import 'logReg'. Check that 'apps.logReg.apps.LogregConfig.name' is correct. I've checked within VS code and it's not linking my logReg app. See here: class LogregConfig(AppConfig): name = 'logReg' Once I delete it, it just says it can't find the second app 'trips' Am I missing something where's it's just not recognizing all my imports? -
Need help in reducing the complexity or duplication in the function mentioned
Hi can someone please help me in reducing the complexity of the below mentioned code as I am new to this I need it to reduce the amount of code and improve the code and to improve simplicity and reduce duplications in the overall coding any any help in this regard can be of great help and thanks in advance for your time and consideration in helping me in this regard. ''' class SynonymSerializer(serializers.ModelSerializer): class Meta: model = synonym fields = 'all' def update(self, instance, validated_data): instance.insured_synonym = validated_data.get('insured_synonym', instance.insured_synonym) instance.obligor_borrower_counterparty_synonym = validated_data.get('obligor_borrower_counterparty_synonym', instance.obligor_borrower_counterparty_synonym) instance.guarantor_synonym = validated_data.get('guarantor_synonym', instance.guarantor_synonym) instance.credit_rating_synonym = validated_data.get('credit_rating_synonym', instance.credit_rating_synonym) instance.country_of_risk_synonym = validated_data.get('country_of_risk_synonym', instance.country_of_risk_synonym) instance.tenor_synonym = validated_data.get('tenor_synonym', instance.tenor_synonym) instance.coverage_synonym = validated_data.get('coverage_synonym', instance.coverage_synonym) instance.insured_transaction_synonym = validated_data.get('insured_transaction_synonym', instance.insured_transaction_synonym) instance.any_third_parties_synonym = validated_data.get('any_third_parties_synonym', instance.any_third_parties_synonym) instance.premium_rate_synonym = validated_data.get('premium_rate_synonym', instance.premium_rate_synonym) instance.margin_synonym = validated_data.get('margin_synonym', instance.margin_synonym) instance.utilization_expected_utilization_synonym = validated_data.get( 'utilization_expected_utilization_synonym', instance.utilization_expected_utilization_synonym) instance.purpose_synonym = validated_data.get('purpose_synonym', instance.purpose_synonym) instance.retained_amount_synonym = validated_data.get('retained_amount_synonym', instance.retained_amount_synonym) instance.insured_percentage_synonym = validated_data.get('insured_percentage_synonym', instance.insured_percentage_synonym) instance.payment_terms_synonym = validated_data.get('payment_terms_synonym', instance.payment_terms_synonym) instance.secured_security_synonym = validated_data.get('secured_security_synonym', instance.secured_security_synonym) instance.waiting_period_synonym = validated_data.get('waiting_period_synonym', instance.waiting_period_synonym) instance.brokerage_synonym = validated_data.get('brokerage_synonym', instance.brokerage_synonym) instance.broker_synonym = validated_data.get('broker_synonym', instance.broker_synonym) instance.ipt_synonym = validated_data.get('ipt_synonym', instance.ipt_synonym) instance.enquiry_code_synonym = validated_data.get('enquiry_code_synonym', instance.enquiry_code_synonym) instance.law_synonym = validated_data.get('law_synonym', instance.law_synonym) instance.terms_of_repayment_synonym = validated_data.get('terms_of_repayment_synonym', instance.terms_of_repayment_synonym) instance.financials_limit_synonym = validated_data.get('financials_limit_synonym', instance.financials_limit_synonym) fields_25_synonym_key = [ 'insured_synonym', 'obligor_borrower_counterparty_synonym', 'guarantor_synonym', 'credit_rating_synonym', 'country_of_risk_synonym', 'tenor_synonym', 'coverage_synonym', 'insured_transaction_synonym', 'any_third_parties_synonym', 'premium_rate_synonym', … -
Django: Trying to access the limited no of random question(tell by user) of specific types from the database table
In my Django Project i have a Topic table , Subtopic Table, Question table ,Opions table and Answer table. Here Iam trying to access the limited number of random questions of specific subtopics [both the no of questions(limited number of questions) and subtopics are chosen by user]. like below one here is my models.py class Add_Topics(models.Model): grade = models.ForeignKey(Add_Grade,on_delete=models.CASCADE, default = 1) topic = models.CharField(max_length=40) def __int__(self): return id class Meta: db_table = 'Add_Topics' class Sub_Topics(models.Model): grade = models.ForeignKey(Add_Grade,on_delete=models.CASCADE, default = 1) topic = models.ForeignKey(Add_Topics,on_delete=models.CASCADE, default = 1) videofile = models.FileField(upload_to='videos/', null=True, verbose_name="") subtopic = models.CharField(max_length=40, default = 1) def __str__(self): return self.subtopic class Meta: db_table = 'Sub_Topics' class Questions(models.Model): grade = models.ForeignKey(Add_Grade,on_delete=models.CASCADE, default = 1) topic = models.ForeignKey(Add_Topics, on_delete= models.CASCADE , default = 1) sub_topic = models.ForeignKey(Sub_Topics, on_delete= models.CASCADE, default = 1) question = models.CharField(max_length=100) image= models.URLField(null=True) difficulty=models.CharField(max_length=100, default='') class Meta: db_table = 'questions' class Options(models.Model): grade = models.ForeignKey(Add_Grade,on_delete=models.CASCADE, default = 1) topic = models.ForeignKey(Add_Topics, on_delete= models.CASCADE, default = 1) sub_topic = models.ForeignKey(Sub_Topics, on_delete= models.CASCADE, default = 1) question = models.ForeignKey(Questions, on_delete= models.CASCADE, default = 1) option1 = models.CharField(max_length=20) option2 = models.CharField(max_length=20) option3 = models.CharField(max_length=20) option4 = models.CharField(max_length=20) class Meta: db_table = 'Options' class Answers(models.Model): grade = models.ForeignKey(Add_Grade,on_delete=models.CASCADE, default … -
Sub domain does not show cookie sent by server in response header
App description - Frontend - React hosted on a.example.com Backend - Django hosted on b.example.com Django sends a cookie in get request like below - set-cookie: sessionid=iqyb5hgi6m3qmeojyb07a794z3x2wtz0; Domain=a.example.com; expires=Wed, 09 Jun 2021 18:25:19 GMT; HttpOnly; Max-Age=1209600; Path=/; SameSite=None; Secure In Django settings, I tried giving the most possible access to test if things works, of course not for production, like below - CORS_ORIGIN_ALLOW_ALL = True SESSION_COOKIE_DOMAIN = 'a.example.com' CSRF_COOKIE_SECURE = True SESSION_COOKIE_SECURE = True CSRF_COOKIE_SAMESITE = 'None' SESSION_COOKIE_SAMESITE = 'None' ALLOWED_HOSTS = ['.example.com'] CSRF_TRUSTED_ORIGINS = ['a.example.com'] CSRF_ALLOWED_ORIGINS = ['a.example.com'] CORS_ALLOW_ALL_ORIGINS = True CORS_ALLOW_CREDENTIALS = True But does not show up in cookies in the browser. What am I doing wrong? Any help appreciated! Thanks -
How to make Heroku to store my updates to the website?
I have deployed a new Django project to Heroku and any changes to the database via the project are getting lost or reset after a dyno restart. I don't want this to happen. What are the ways to not lose the data? I am also planning on buying a paid version of Heroku for my project. So , the solutions with paid resources are also appreciated. Thank You in advance. -
How can translations be activated in Postorius / Mailman3-Web?
So I installed mailman3-full on a fresh debian buster machine, along with dovecot, postfix, and sqlite3. After several days of tweaking I managed to get it all running nicely, with one exception: Until now, I was not able to figure out, how I would alter the language of the web-frontend. I already did install package locales on the system, set de_DE.UTF8 as default locale and ran locale-gen set default_locale: de in /etc/mailman3/mailman.cfg set the following in /etc/mailman3/mailman-web.py: LANGUAGE_CODE = 'de' USE_I18N = True USE_L10N = True The docs give some advise, how to list available langauges: launching mailman shell, then entering from mailman.interfaces.languages import ILanguageManager from zope.component import getUtility from zope.interface.verify import verifyObject mgr = getUtility(ILanguageManager) list(mgr.codes) list(mgr.languages) I see that German (de) is available as well as others. But this page gives no advise, how to activate a specific langauge. The contibution guide states something about Weblate, and po files, but no instructions for activation here. In the installation instructions using Virtualenv there is a section Compile messages for l10n. When I replace mailman-web with /usr/share/mailman3-web/manage.py I am able to run all the commands (e.g. /usr/share/mailman3-web/manage.py collectstatic), the compilemessages command gives me an error: CommandError: This script should be … -
Django model ordering one model by count in another model referenced by GenericForeignKey
I am using Django 3.2 I have the following apps and models: social/models.py class SocialAction(models.Model): content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE,related_name='%(class)s_content_type') object_id = models.PositiveIntegerField() content_object = GenericForeignKey('content_type', 'object_id') user = models.ForeignKey(User, blank=False, null=False, on_delete=models.CASCADE,related_name='likes') created = models.DateTimeField(auto_now_add=True) class Meta: abstract = True constraints = [ models.UniqueConstraint(fields=['content_object', 'user'], name="unique_like"), ] class Like(SocialAction): pass foo/models.py class Foo(models.Model): pass Note: I cannot modify Foo code, but I want to add "Like" functionality to Foo. I have utility functions that add creates new records in the Like table, and adds the references to the object that has been liked. I want to write a queryset function, that returns a set of Foo objects, but ranked in DESC order of likes. I know I have to use either aggregation or annotations - but I'm not sure how. def get_most_liked_foo(): return Foo.objects.filter() # /* not sure how to construct rest of query */ My question is - how do I return a recordset of Foo objects, ranked by most liked? -
How does python find modules without a path?
For example, when using django I can get my settings from anywhere within the project using from djanog.conf import settings. I don't have to specify where django.conf is, it just knows. How does it know? I ask because I'm building a project where I need to be able to import a conf file without knowing the relative path. What is the best way to do this? I'm sure some variation of this question has been asked hundreds of times before but I can't seem to find the answer. If you of a good answer that already exists please let me knows. Thanks.s -
How to get few last rows from related table?
Need help with a orm request. There are 2 tables. Author and Book (names for example, so you don't need to look at the logic), linked through FK. class Book(models.Models): title = models.Charfield(...) class Author(models.Model): book = models.ForeignKey(Book) Need to group the authors by the book and go through them in a loop. The question is how to select only the last 50 authors of each book. I can write this: for book in Book.all() for author in book.author_set.all()[:50]: .... But this is not an optimal solution. -
How can I integrate django with react?
My website uses as frontend reactjs and django as backend. I couldn't do the integration between the frontend and the backend. The backend is based on a deep learning model. PS: The frontend will send a text (which you have to upload) to the backend. And the backend will send a result using the model prediction. -
How can I crop an image with Cropperjs without losing quality?
I'm showing a previously uploaded image on the client side and using cropperjs to let the user crop it and then re-upload with a button click. const submit_button = document.getElementById('submit-btn'); const input = document.getElementById('id_file'); const image = document.getElementById('image'); let cropper = new Cropper(image, { autoCropArea: 1, zoomable: false, preview: '.preview' }) input.addEventListener('change', () => { const img_data = input.files[0] image.src = URL.createObjectURL(img_data); cropper.replace(image.src) }); submit_button.addEventListener('click', () => { cropper.getCroppedCanvas({ imageSmoothingEnabled: true, imageSmoothingQuality: 'high' }).toBlob((blob) => { let file = new File([blob], "cropped.png", {type: "image/png", lastModified: new Date().getTime()}); let container = new DataTransfer(); container.items.add(file); input.files = container.files; document.getElementById("form").submit(); }, 'image/png', 1); }); The code works just fine, except that the image get's compressed with every new crop. How can I disable compression? I already tried some suggestions (imageSmoothing, setting quality to 1), but that does nothing at all. -
Hot to find out if it is first user log in with django social?
I am building an app, witch django social, and i need to do some stuff when user register, but i can not find out whether this is his first log in or not, how can i do that without alter user db, and without last_login == date_joined (because i think it's pretty dirty way, tell me if not) Also sorry for my bad english in some places. -
How to create web application for CNN model using react
I am currently working on my python project based on Keras CNN models. I want to deploy the project to a website. For front-end I want to use React.js just because I have my expertise in it. I am confuse for the backend technology I should use, below are the technologies I have explored. 1)Flask 2)Django 3)Spring I want your suggestions which is the best for me to use. I have two models one is working on the output of other which means I have python code between the results of two models. Waiting for your suggestion. Thanks in advance. -
Error (1045, "Access denied for user 'user'@'172.27.0.3' (using password: YES)")
In trying to connect to connect to mysql using docker but I get the following logs below. How do I resolve this? db_1 | Version: '5.7.34' socket: '/var/run/mysqld/mysqld.sock' port: 3307 MySQL Community Server (GPL) db_1 | 2021-05-26T17:02:40.191347Z 2 [Note] Access denied for user 'admin'@'172.27.0.3' (using password: YES) db_1 | 2021-05-26T17:02:40.259636Z 3 [Note] Access denied for user 'admin'@'172.27.0.3' (using password: YES) db_1 | 2021-05-26T17:02:40.275977Z 4 [Note] Access denied for user 'admin'@'172.27.0.3' (using password: YES) db_1 | 2021-05-26T17:02:40.361165Z 5 [Note] Access denied for user 'admin'@'172.27.0.3' (using password: YES) db_1 | 2021-05-26T17:02:40.366075Z 6 [Note] Access denied for user 'admin'@'172.27.0.3' (using password: YES) db_1 | 2021-05-26T17:02:40.367748Z 7 [Note] Access denied for user 'admin'@'172.27.0.3' (using password: YES) db_1 | 2021-05-26T17:02:40.370714Z 8 [Note] Access denied for user 'admin'@'172.27.0.3' (using password: YES) db_1 | 2021-05-26T17:02:40.372608Z 9 [Note] Access denied for user 'admin'@'172.27.0.3' (using password: YES) db_1 | 2021-05-26T17:02:40.402829Z 10 [Note] Access denied for user 'admin'@'172.27.0.3' (using password: YES) db_1 | 2021-05-26T17:05:14.885240Z 11 [Note] Access denied for user 'root'@'localhost' (using password: NO) Docker Compose File version: '3' services: # redis: # restart: always # image: redis:latest # expose: # - "6379" db: image: mysql:5.7 command: --default-authentication-plugin=mysql_native_password restart: always environment: MYSQL_DATABASE: default_schema MYSQL_USER: admin MYSQL_PASSWORD: test MYSQL_ROOT_PASSWORD: *asus@2837 MYSQL_TCP_PORT: … -
Annotate filed with first key in JSON Field
I have model with JSON type field json_field_name { "123": "1", "145": "2" } I want to use annotate function to create a new column "json_first_key" , that will contain the First key in every json . I want a new annotated field - "json_first_key" , that will contains only the first key in the json . ie "123" , in this case I can do the same using rawSQL query . I would like to do it using Django ORM instead . I am using Postgresql database. Using RawSQL models = Model.objects..annotate( json_first_key=RawSQL( """select first_key from (select distinct on (id) id,jsonb_object_keys(json_field_name) AS first_key FROM app_model) as model_row where model_row.id = app_model.id limit 1""", [], ) ) -
One difference between node.js that use javascript server side and Django that use Python sever side
Django with python server side can pass just string to javascript client side ! if i start using node.js(javascript anywere) server side , can i pass other type of variables to javascript es. integer, boolean ecc... ? or to use node.js pass the same type of variables as python language ? -
Cannot assign "...'": "..." must be a "User" instance
models.py for assistance class AssistanceQuest (models.Model): Customer = models.ForeignKey(settings.AUTH_USER_MODEL,on_delete=models.CASCADE,blank=True,null=False) Status = models.BooleanField(default=False,null=False,blank=False) Date_request = models.DateTimeField(auto_now_add=False) Tipology = models.CharField(max_length=50, null= False) Request = models.TextField(max_length= 1000, blank=False, null=False) models.py for Custom User from django.contrib.auth.models import AbstractUser from .managers import CustomUserManager class User (AbstractUser): is_superuser = None is_staff = None groups = None user_permissions = None objects = CustomUserManager() manager.py for Custom User from django.contrib.auth.base_user import BaseUserManager from django.utils.translation import ugettext_lazy as _ class CustomUserManager(BaseUserManager): """ Custom user model manager senza staff o permessi """ def create_user(self, username,email,first_name,last_name,password): if not email: raise ValueError(_('The Email must be set')) email = self.normalize_email(email) user = self.model(username = username, email = email, first_name = first_name, last_name = last_name) user.set_password(password) user.save() return user and this is the view.py for the assistances if User.is_authenticated: Message = "Assistance Request From " + str(User.get_full_name(User)) + ": "+ str(User.email) else: Message = "Assistance Request From " + request.POST['message-name-surname']+"\n Email: "+ request.POST['message-email'] Message += "\n City: "+ request.POST['message-city']+"\n Province: "+ request.POST['message-province']+"\n Landline Or Mobile Phone: "+ request.POST['message-phone']+"\n Number Order Or Purchase Period: "+ request.POST['message-number-order']+"\n Product Under Warranty: "+ request.POST['message-warranty']+"\n Request: "+ request.POST['message']+"\n Prefers To Be Contacted: "+ request.POST['message-pref-contact'] if User.is_authenticated: user= settings.AUTH_USER_MODEL Assistance = AssistanceQuest(Customer=user, Status= 'False',Request= Message, Tipology='Tecnica',Date_request=datetime.datetime.now()) Assistance.save() Subject = "Assistance … -
django admin site nav sidebar messed up
I recently added a package to my project and did a pip freeze > requirements.txt afterwards. I then did pip install -r requirements.txt to my local and it added a sidebar. I did a pip install -r requirements.txt to the server as well and it produced a different result. It's sidebar was messed up. I tried removing the sidebar by doing this answer but it did not get removed. .toggle-nav-sidebar { z-index: 20; left: 0; display: flex; align-items: center; justify-content: center; flex: 0 0 23px; width: 23px; border: 0; border-right: 1px solid var(--hairline-color); background-color: var(--body-bg); cursor: pointer; font-size: 20px; color: var(--link-fg); padding: 0; display: none; /*added*/ } #nav-sidebar { z-index: 15; flex: 0 0 275px; left: -276px; margin-left: -276px; border-top: 1px solid transparent; border-right: 1px solid var(--hairline-color); background-color: var(--body-bg); overflow: auto; display: none; /*added*/ } What should I do to remove this? -
Reverse for '' not found. '' is not a valid view function or pattern name ERROR that i cannot see
Django 3 error - Reverse for '' not found. '' is not a valid view function or pattern name. Driving me insane - I have looked at all the other solutions on SO for this type of error and none apply. Can anyone spot what the solution is? part of the base.html <li class="nav-item"> <a class="nav-link" href="{% url 'item-shoppinglist' %}">Shopping List</a> </li> the view class ItemShoppingList(generic.TemplateView): model = Item template_name = 'kitchens/shoppinglist.html' def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['item_list'] = Item.objects.filter(item_shoppinglist=1) return context OP/urls.py from django.contrib import admin from django.urls import path from django.urls import include from django.conf import settings from django.conf.urls.static import static urlpatterns = [ path('admin/', admin.site.urls), path('kitchens/', include('kitchens.urls')), ] #Add URL maps to redirect the base URL to our application from django.views.generic import RedirectView urlpatterns += [ path('', RedirectView.as_view(url='/kitchens/', permanent=True)), ]+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) Kitchens/urls.py - from django.urls import include, path from . import views urlpatterns = [ path('', views.index, name='index'), path('location/', views.LocationListView.as_view(), name='location'), path('location/<int:pk>', views.LocationDetailView.as_view(), name='location-detail'), path('location/create/', views.LocationCreate.as_view(), name='location-create'), path('location/<int:pk>/update/', views.LocationUpdate.as_view(), name='location-update'), path('location/<int:pk>/delete/', views.LocationDelete.as_view(), name='location-delete'), path('shelf/', views.ShelfListView.as_view(), name='shelf'), path('shelf/<int:pk>', views.ShelfDetailView.as_view(), name='shelf-detail'), path('shelf/create/', views.ShelfCreate.as_view(), name='shelf-create'), path('shelf/<int:pk>/update/', views.ShelfUpdate.as_view(), name='shelf-update'), path('shelf/<int:pk>/delete/', views.ShelfDelete.as_view(), name='shelf-delete'), path('ajax/load-shelfs/', views.load_shelfs, name='ajax_load_shelfs'), # <-- this one here path('item/', views.ItemListView.as_view(), name='item'), path('item/<int:pk>', views.ItemDetailView.as_view(), name='item-detail'), path('item/create/', views.ItemCreate.as_view(), name='item-create'), … -
Display profile image of a customuser in django
I am trying to show the uploaded image of a student in student profile but its not working. Below is my code Models.py class Students(models.Model): id=models.AutoField(primary_key=True) admin=models.OneToOneField(CustomUser,on_delete=models.CASCADE) gender=models.CharField(max_length=255) profile_pic = models.ImageField(null=True,blank=True) address=models.TextField() course_id=models.ForeignKey(Courses,on_delete=models.CASCADE) session_year_id=models.ForeignKey(SessionYearModel,on_delete=models.CASCADE) created_at=models.DateTimeField(auto_now_add=True) updated_at=models.DateTimeField(auto_now_add=True) fcm_token=models.TextField(default="") objects = models.Manager() Views.py def student_profile(request): user=CustomUser.objects.get(id=request.user.id) student=Students.objects.get(admin=user) return render(request,"student_template/student_profile.html",{"user":user,"student":student}) Template. <img src="{{ request.admin.user.profile_pic.url }}" class="img-circle elevation-2" alt="User Image"> -
How to secure media files in django in poduction?
I am trying to make a project and have some media files which should only be accessed by their owner. In production, media and static files are served by apache (or nginx but I am using apache). I was looking for some solutions and I am not able to apply. On djangosnippets website, I found this code, from mod_python import apache from django.core.handlers.base import BaseHandler from django.core.handlers.modpython import ModPythonRequest class AccessHandler(BaseHandler): def __call__(self, req): from django.conf import settings # set up middleware if self._request_middleware is None: self.load_middleware() # populate the request object request = ModPythonRequest(req) # and apply the middleware to it # actually only session and auth middleware would be needed here for middleware_method in self._request_middleware: middleware_method(request) return request def accesshandler(req): os.environ.update(req.subprocess_env) # check for PythonOptions _str_to_bool = lambda s: s.lower() in ("1", "true", "on", "yes") options = req.get_options() permission_name = options.get("DjangoPermissionName", None) staff_only = _str_to_bool( options.get("DjangoRequireStaffStatus", "on") ) superuser_only = _str_to_bool( options.get("DjangoRequireSuperuserStatus", "off") ) settings_module = options.get("DJANGO_SETTINGS_MODULE", None) if settings_module: os.environ["DJANGO_SETTINGS_MODULE"] = settings_module request = AccessHandler()(req) if request.user.is_authenticated(): if superuser_only and request.user.is_superuser: return apache.OK elif staff_only and request.user.is_staff: return apache.OK elif permission_name and request.user.has_perm( permission_name ): return apache.OK return apache.HTTP_UNAUTHORIZED But I am not able to install mod_python. … -
From Laravel to Django questions
I have been a Laravel developer for the past years, and I made most of my projects using Laravel. But now I'm working on a project that it needs a recommendation system and after looking around the web I found out that there's no Laravel package for this purpose and the best thing to do is to use python, and after doing a lot of research I think the best python framework to develop backend servers for a website or an application is Django. But to move from PHP Laravel to Python Django it's kinda hard to find the answers of the questions since the diffent ecosystem they, have and after doing searches on google I can't find the answers. so I have these questions I hope someone answer it one by one as I wrote it: 1- can I use any python packages with Django? like in Laravel you can use any php package using composer, or you can only use the packages in Django package system? 2- If one day moved to another Python framework like Flask, can I use the packages developed for Django? 3- I know Django does not support Rest API, do I have to … -
I dont know why my project in django return ModuleNotFoundError: No module named -
I have a django project with gunicorn and nginx. Everything was going well, but when I installed decouple for the environment variables, it started to give me the following errors: Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 589, in spawn_worker worker.init_process() File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/base.py", line 134, in init_process self.load_wsgi() File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/base.py", line 146, in load_wsgi self.wsgi = self.app.wsgi() File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/base.py", line 67, in wsgi self.callable = self.load() File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 58, in load return self.load_wsgiapp() File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp return util.import_app(self.app_uri) File "/usr/local/lib/python3.6/dist-packages/gunicorn/util.py", line 359, in import_app mod = importlib.import_module(module) File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 994, in _gcd_import File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked ModuleNotFoundError: No module named '-' What can I do to fix it? Let me know if you need more files. Thanks for your help. -
Want to build a file conversion website using React and Django
Actually, I want to build a website which converts one file format to another. And looking for various resources. But, I could not find appropriate resources to do so. Note:- I can't use some paid APIs. I want to build it based on some 3rd party libraries or some open source APIs. Is there anything i can do to find resources for same? -
How to combine social auth/oauth with django custom user model
I have a custom user model that is based on AbstractBaseUser, PermissionsMixin and I would love to use a package such as django-allauth and/or social-auth-app-django. I have done some research but did not find any tutorials or examples. Can somebody recommend anything?