Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
ProgrammingError column Users_student.school does not exist in django
I've been struggling with this issue for hours now. I have a model in my app which goes like this class Student(models.Model): school = models.CharField(max_length=100, null=True, blank=True) field_of_study = models.CharField(max_length=100, null=True, blank=True) user = models.OneToOneField(CustomUser, on_delete=models.CASCADE, related_name='Student') courses = models.ManyToManyField('StudentDashboard.Course', related_name="student_courses") And whenever I try to view details of this class through django admin panel, I face the error ProgrammingError column Users_student.school And if I comment school, that happens for field_of_study. And if that is commented too, It works fine. But I actually do need those 2 fields so I can't just comment them and go on. Anyone knows a solution to this? Thanks in advance! -
Make docker automatically run collecstatic and migrate in Django
I have a following question. I have dockerized Django project and instead of manually run collectstatic and migrate each and every time I would like to docker do it for me. Is it possible to make Docker automatically run: python manage.py collectstatic --noinput python manage.py migrate every time when image is created? Or alternatively before container is started… My Dockerfile: FROM python:3.8.6-alpine LABEL project="short_urls" ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 WORKDIR /code COPY Pipfile Pipfile.lock /code/ RUN pip install pipenv && pipenv install --system --ignore-pipfile COPY short_urls /code/ Docker-Compose.yaml version: '3.8' volumes: redis_data: services: web: build: . command: python /code/manage.py runserver 0.0.0.0:8000 volumes: - .:/code ports: - target: 8000 published: 8000 protocol: tcp mode: host depends_on: - redis restart: always redis: image: redis:6.0.9-alpine command: redis-server ports: - target: 6379 published: 6380 protocol: tcp mode: host volumes: - redis_data:/data restart: always environment: - REDIS_REPLICATION_MODE=master celery: build: . command: celery -A short_urls worker --loglevel=INFO -E restart: always environment: - C_FORCE_ROOT=1 volumes: - .:/code links: - redis depends_on: - web - redis hostname: celery-main celery-beat: build: . command: celery -A short_urls beat --loglevel=INFO --pidfile= restart: always volumes: - .:/code depends_on: - web - redis hostname: celery-beat flower: image: mher/flower environment: - CELERY_BROKER_URL=redis://redis:6379/3 - … -
AWS Elastic Beanstalk Django application health check problem
I am having a very similar problem to the one described here. As that question wasn't answered and there are some differences between my problem and the one described there I decided to ask a new question. I managed to deploy my Django backend API to the AWS Elastic Beanstalk Amazon Linux 2 Python 3.7 platform. However, the health status of the EB instance is "Severe". It shows the message: Following services are not running: release. The overall health status is "Degraded" and the message is Impaired services on all instances. Sometimes a message saying that all responses are 4xx appears. This message comes and goes. The weird thing is that I have 2 load balancers configured (one for http and the other one for https) and both have a health check path url of a valid url in the application. The only relevant logs I could find are the following: daemon.log F, [2020-11-05T00:07:40.486088 #15846] FATAL -- : /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.6.0/gems/puma-4.3.5/lib/puma/launcher.rb:432:in `block in setup_signals': SIGTERM (SignalException) from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.6.0/gems/puma-4.3.5/lib/puma/single.rb:117:in `join' from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.6.0/gems/puma-4.3.5/lib/puma/single.rb:117:in `run' from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.6.0/gems/puma-4.3.5/lib/puma/launcher.rb:172:in `run' from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.6.0/gems/puma-4.3.5/lib/puma/cli.rb:80:in `run' from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.6.0/gems/healthd-1.0.6/bin/healthd:112:in `block in <top (required)>' from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.6.0/gems/healthd-1.0.6/bin/healthd:19:in `chdir' from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.6.0/gems/healthd-1.0.6/bin/healthd:19:in `<top (required)>' from /opt/elasticbeanstalk/lib/ruby/bin/healthd:23:in `load' from /opt/elasticbeanstalk/lib/ruby/bin/healthd:23:in `<main>' web.stdout.log (...) Nov 5 09:26:18 … -
How to avoid "AttributeError: 'ModelFormOptions' object has no attribute 'concrete_model'" in Django Ajax form submit
I have been trying to post records in related models in my Django app using Ajax. In order to update a pair of parent/child models, I am using the following view and the records are getting saved in the respective models. However, I keep getting the following error: AttributeError: 'ModelFormOptions' object has no attribute 'concrete_model'" The following is the set up: views.py class MatListCreateView(LoginRequiredMixin, CreateView): template_name = "..." model = MatHdrList form_class = CreateMatHdrListForm def get(self, request, *args, **kwargs): self.object = None form_class = self.get_form_class() form = self.get_form(form_class) mat_bom_list = CreateBomMatListFormset return self.render_to_response( self.get_context_data(form=form, mat_bom_list=mat_bom_list) ) def post(self, request, *args, **kwargs): form_class = self.get_form_class() form = self.get_form(form_class) mat_bom_list = CreateBomMatListFormset(self.request.POST) if self.request.is_ajax and self.request.method == "POST": if form.is_valid() and mat_bom_list.is_valid(): form.instance.created_by = self.request.user self.object = form.save() mat_bom_list.instance = self.object mat_bom_list.save() ser_instance = serializers.serialize('json', [ form, mat_bom_list, ]) return JsonResponse({"instance": ser_instance}, status=200) else: return JsonResponse({"error": form.errors}, status=400) return JsonResponse({"error": "Whoops"}, status=400) Template (jQuery ajax part) $('#materialListForm').submit(function(e) { e.preventDefault(); var serializedData = $(this).serialize(); console.log(serializedData); // var url1 = "{% url 'matl_list' %}"; $.ajax({ url: "{% url 'material_list_create' %}", type: 'POST', data: serializedData, success: function() { console.log('Data Saved'); // window.location = url1; }, error: function (response, status, error) { console.log('Problem encountered'); alert(response.responseText); } … -
Django ORM binary exact
Suppose I have a MySQL database with a _ci (case insensitive) collation with a table like this: |ID | name | -------------- |0 | John | Being case insensitive, if I query either way: SELECT * FROM table1 WHERE name = "john" or SELECT * FROM table1 WHERE name = "John" Would return the element. Django obviously acts the same way: MyObject.objects.get(name="john") Would return the instance. In MySQL I can query like this to force case sensitivity: SELECT * FROM table1 WHERE BINARY name = "john" That would return me nothing My question is: How to replicate the Binary query operator using the Django ORM? -
Python manage.py migrate doesn't create tables
The problem is that the python manage.py migrate fails due to the absence of tables in the database, but actually, it should create them. And now in more detail: For several days now I have been trying to solve the problem, so maybe I forgot something from what I did before. I originally had one model class Product(models.Model): code = models.CharField(max_length=50) quantity = models.PositiveIntegerField(default=1) name = models.CharField(max_length=255) slug = AutoSlugField(_('slug'), max_length=255, unique=True, populate_from=('name',)) technology = models.CharField(max_length=255) status = models.CharField(max_length=255, default='Exists') description = models.TextField() Then I needed to make a mptt model from this model to make a product tree and I changed the code like this: class Product(MPTTModel): code = models.CharField(max_length=50) quantity = models.PositiveIntegerField(default=1) name = models.CharField(max_length=255) slug = AutoSlugField(_('slug'), max_length=255, unique=True, populate_from=('name',)) technology = models.CharField(max_length=255) status = models.CharField(max_length=255, default='Exists') description = models.TextField() parent = TreeForeignKey('self', on_delete=models.CASCADE, null=True, blank=True, related_name='children') class MPTTMeta: order_insertion_by = ['code'] And the problems started ... The migrations did not want to be applied due to the missing parent _id column. I tried a lot of things then, in the end the following helped me: I manually created the columns parent_id, lft, rght, level, tree_id. And it all worked. Then I decided that for my task … -
Еhere was an error while adding url to test
When I transfer to the test url, an error pops up: Reverse for 'movie' not found. 'movie' is not a valid view function or pattern name. Here is my self test: class BooksApiTestCase(APITestCase): def setUp(self): self.movie_1 = Movie.objects.create(title="terminator", year="1990", rating="5",url="retminator") self.movie_2 = Movie.objects.create(title="robocop", year="1991", rating="4",url="robocop") self.movie_3 = Movie.objects.create(title="rembo", year="1992", rating="3",url='rembo') def test_get(self): url = reverse('movie') print(url) response = self.client.get(url) serializer_data = MovieListSerializer([self.movie_1, self.movie_2, self.movie_3], many=True).data self.assertEqual(status.HTTP_200_OK, response.status_code) self.assertEqual(serializer_data, response.data) Here is my self url: urlpatterns = format_suffix_patterns([ path("movie/", views.MovieViewSet.as_view({'get': 'list'})), -
Django: Saving uploaded file in specific directory
I want to save files that the user uploads in the project directory 'media/documents/(their user id)/filename.pdf'. I tried doing this: def user_directory_path(request, filename): return 'user_{0}/{1}'.format(request.user.id, filename) But I get this error: I am not sure what to do, I am a bit of a django noob. I appreciate any help! My models.py: from django.db import models from django.contrib.auth.models import AbstractBaseUser def user_directory_path(request, filename): return 'user_{0}/{1}'.format(request.user.id, filename) class Contract(models.Model): id = models.AutoField(primary_key = True) title = models.CharField(max_length=50) date_created = models.DateTimeField(auto_now_add=True) file = models.FileField(upload_to=user_directory_path, default = 'settings.MEDIA_ROOT/documents/default.pdf') class Meta: ordering = ['-date_created'] def __str__(self): return self.title class Employer(AbstractBaseUser): id = models.AutoField(primary_key=True) first_name = models.CharField(max_length=20) last_name = models.CharField(max_length=20) company_name = models.CharField(max_length=50) contracts_made = models.ForeignKey(Contract, on_delete=models.CASCADE, default=1) date_joined = models.DateTimeField(auto_now_add=True) class Meta: ordering = ['-date_joined'] def __str__(self): full_name = str(self.first_name) + " " + str(self.last_name) return full_name class Employee(AbstractBaseUser): id = models.AutoField(primary_key=True) first_name = models.CharField(max_length=20) last_name = models.CharField(max_length=20) date_joined = models.DateTimeField(auto_now_add=True) agreed = models.ForeignKey(Contract, on_delete=models.CASCADE, default=1) class Meta: ordering = ['date_joined'] def __str__(self): full_name = str(self.first_name) + " " + str(self.last_name) return full_name Views.py: from django.shortcuts import render, redirect from .forms import UploadFileForm def HomePageView(request): return render(request, 'home.html') def model_form_upload(request): if request.method == 'POST': form = UploadFileForm(request.POST, request.FILES) if form.is_valid(): form.save() return redirect('home') else: … -
Django and Python Room Booking System
I am new to Django and programming in general so this is my first ever web app and experience with Django. My idea was to create a basic meeting room booking system. The system should allow the user to: -login -click a room and make a reservation (select date, time) -amend bookings -cancel bookings -send an email notification confirming reservation -not allow users to block a slot that is already reserved I was wondering if anyone could give me any advice on how to approach making something along these lines as my research shows I will also need a 'virtual environment' which I have never used before. Any advice or assistance at all would be appreciated! Thanks -
Send a whatsapp message with django
I am building a django e-commerce webapp with django.My client wants users to order the products directly on whatsapp and facebook by recieving an automatic message that says I want to order {{ productname }} product name will be the name of the product the users want to order. I have looked into some twillo tutorials and i can't seem to understand how to go about it. The e-commerce website has already been deployed with heroku. I would be happy if i'm offered some help about how to do this. -
Django: Late switch to Custom User Model always hurts?
The official Django documentation "highly recommends" implementing a custom user model and William S. Vincent says in "Django for Professionals": If you have not started with a custom user model from the very first migrate command you run, then you’re in for a world of hurt because User is tightly interwoven with the rest of Django internally. It is challenging to switch over to a custom user model mid-project. Unfortunately, I saw these recommendations too late and now I wonder, if this pain is always the case or only if you already make use of users somehow. In my Django project, there is only one single user and none of my models are related to users in any kind (which I am planning to change soon). Is there any hope that it wouldn't get that terrible? This extensive guide, for example, has the following assumptions: You have an existing project without a custom user model. You're using Django's migrations, and all migrations are up-to-date (and have been applied to the production database). You have an existing set of users that you need to keep, and any number of models that point to Django's built-in User model. Actually, I do not … -
Django Docker Setup Issue, Any one can check the mistake
version: '3.7' services: backend: build: ./app command: sh -c "cd project python3 manage.py migrate && python3 manage.py runserver 0.0.0.0:8000" ports: - 8000:8000 depends_on: - db network_mode: host frontend: build: ./app ports: - 80:80 command: sh -c "npm run start:production" db: image: postgres:12.0-alpine ports: - 5432:5432 volumes: - postgres_data:/var/lib/postgresql/data/ environment: - POSTGRES_USER= - POSTGRES_PASSWORD= - POSTGRES_DB= volumes: postgres_data: -
NoReverseMatch at /cars/
i am working on a project . i use crispy_form in my project. it is my cars urls.py:: from django.urls import path from . import views app_name = 'cars' urlpatterns = [ path('', views.CarsListView.as_view(), name='cars'), path('add-car/', views.AddCarView.as_view(), name='add_car'), path('car/', views.RepairsListView.as_view(), name='car_detail'), path('car/<int:pk>/update/', views.UpdateCarView.as_view(), name='update_car'), path('car/<int:pk>/delete/', views.DeleteCarView.as_view(), name='delete_car'), path('car/<int:pk>/new-repair/', views.AddRepairView.as_view(), name='add_repair'), ] it is my cars views.py :: from .models import Car, Repair from django.views.generic import ListView, UpdateView, DeleteView, CreateView from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin from django.urls import reverse_lazy from django.contrib import messages class CarsListView(LoginRequiredMixin, ListView): model = Car template_name = 'cars/cars.html' context_object_name = 'cars' paginate_by = 10 def get_queryset(self): if self.request.GET.get('q'): q = self.request.GET.get('q') make_results = self.model.objects.filter( user=self.request.user, make=q).order_by('-pk') model_results = self.model.objects.filter( user=self.request.user, model=q).order_by('-pk') if make_results.exists(): return make_results elif model_results.exists(): return model_results else: return self.model.objects.none() return self.model.objects.filter(user=self.request.user).order_by('-pk') def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['q'] = self.request.GET.get('q', '') return context class AddCarView(LoginRequiredMixin, CreateView): model = Car fields = ['make', 'model', 'vrn', 'year'] success_url = '/' def form_valid(self, form): form.instance.user = self.request.user return super().form_valid(form) class DeleteCarView(LoginRequiredMixin, UserPassesTestMixin, DeleteView): model = Car success_url = '/' def test_func(self): if self.get_object().user == self.request.user: return True return False def delete(self, request, *args, **kwargs): success_message = f'Car {self.get_object()} has been deleted' messages.success(self.request, success_message) return super().delete(request, *args, **kwargs) … -
How can I create such a form in Django and what is the name of this type of form?
I'm trying to create a form in Django, part of which is a long list of strings (component names). The user using the form should be able to select one or more components, move them from the left list to the right, and submit these names (in the right list) with the form. This is also used in the Django administration interface as you can see on my screenshot. Django admin interface Unfortunately, I have no idea what this type of form is called. Therefore it is difficult to find a solution on google if you don't have the right search parameters ...;) If someone even had a snippet of code to create this form, it would be even better. -
Django option set displaying only one value and passing Null
I have a following code in django html <select name="my_option"> {% for things in my_data %} <option value="{{things.accountid}}"> {{ things.address1_name }} {{ things.address1_city }}</option> {% endfor %} </select> views.py def my_view(request): my_data = my_data.objects.all if request.method == "POST": my_option = request.POST.get('my_option', None) post_data = {'my_option': my_option} if my_option is not None: response = requests.post('my_working_url', json=post_data) content = response.content messages.success(request, 'Data passed') return redirect('home') else: return redirect('home') else: return render(request, 'my_view.html', {'my_data':my_data}) In the option set I can see only things.address1_name being displayed and I'm absolutely sure I have values in the database for all other fields used. Also my request.POST.get returns Null instead of accountid as I would like the user to be able to see only address values and not accountid but pass the accountid value to the code in views.py How can I fix this? -
Django email as username with already custom-made sign up form?
I followed this tutorial to set up a custom sign up form which requires an email and password to sign up new user (i.e. no username). I also followed this tutorial to send an email with a confirmation link to create the accounts. How can I then assign a username to each account? Perhaps using the name in their name@domain.com, and adding random numerical characters to the end of name to make it unique if identical to other already registered names. my-website/views.py from django.utils.encoding import force_bytes, force_text from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode from django.template.loader import render_to_string from .tokens import account_activation_token from users.models import CustomUser from django.core.mail import EmailMessage from random import choice import string def index(request): return render(request, 'index.html') def signup(request): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): user = form.save(commit=False) user.is_active = False user.save() current_site = get_current_site(request) mail_subject = 'Activate your account.' message = render_to_string('acc_active_email.html', { 'user': user, 'domain': current_site.domain, 'uid':urlsafe_base64_encode(force_bytes(user.pk)), 'token':account_activation_token.make_token(user), }) to_email = form.cleaned_data.get('email') email = EmailMessage( mail_subject, message, to=[to_email] ) email.send() return HttpResponse('Please confirm your email address to complete the registration') else: form = SignUpForm() return render(request, 'signup.html', {'form': form}) def activate(request, uidb64, token, backend='django.contrib.auth.backends.ModelBackend'): try: uid = force_text(urlsafe_base64_decode(uidb64)) user = CustomUser.objects.get(pk=uid) except(TypeError, ValueError, … -
Django complex date filter
I couldn't find relative answer, I have sql table like: +------------+---+----+---+ | date | x | y | z | +------------+---+----+---+ | 2019-01-01 | 1 | 3 | 5 | | 2019-01-02 | 2 | 10 | 2 | | 2019-01-03 | 5 | 4 | 3 | +------------+---+----+---+ Can you please suggest me an efficient query to get data below: "x": { "today": int, "yesterday": int, "this_week": int, "last_week": int, "this_month": int, "last_month": int, "this_year": int, "all_times": int }, "y": { "today": int, "yesterday": int, "this_week": int, "last_week": int, "this_month": int, "last_month": int, "this_year": int, "all_times": int }, "z": { "today": int, "yesterday": int, "this_week": int, "last_week": int, "this_month": int, "last_month": int, "this_year": int, "all_times": int } I can get one column daily or monthly but I couldn't combine them. -
Technique of using if, elif and Else statement in Django python
Let me start with my code for better understanding. models Items(models.Model): first_frame = models.ManyToManyField(settings.AUTH_USER_MODEL,blank=True, default=None,related_name='frame_one') second_frame = models.ManyToManyField(settings.AUTH_USER_MODEL,blank=True, default=None,related_name='frame_two') View def choose_frame(request): frame = get_object_or_404(Item, id=request.POST.get('frame_id')) is_frame_one=False is_frame_two=False if frame.first_frame.filter(id=request.user.id).exists(): frame.first_frame.remove(request.user) is_frame_one=False else: frame.first_frame.add(request.user) is_frame_one=True elif frame.second_frame.filter(id=request.user.id).exists(): frame.second_frame.remove(request.user) is_frame_two=False else: post.first_frame.add(request.user) is_frame_two=True if request.is_ajax(): context={'frame':post, 'is_frame_one':is_frame_one} html=render_to_string('business/frame.html', context, request=request) return JsonResponse({'form':html}) If you take a look at my view, you'll understand I've an if statement were if the user exist the first frame should be removed, Else, you can add frame. But I've another frame in my models just like my first frame called second frame. I want to make the exact functionality, but seems the elif is not the right coding. Thanks for your assistance in advance -
run long process in django without celery and multiprocess
i have a project which gets large csv file from user and process it in django view with multithreading. i can't use multiprocess because process contains external objects which can't be pickled. celery have similar problem with pickling data. I want to use view which handles this large CSV process externally and don't wait for process to complete. and if anyone refresh the page same view calls and another 2 threads creates and i want to prevent to create a new thread. i have something like this code: q = Queue() def view(request): t1 = Thread(target = threadfunction, args=(request,csvdata)) t2 = Thread(target = threadfunction, args=(request,csvdata)) q.put(t1) 1.put(t2) t1.start() t2.start() t1.join() t2.join() data = [] while not q.empty(): data.extend(q.get()) return HttpResponse(str(data)) def threadfunction(receiverequest,csvdata): # reading csv and doing some process takes 100secs returns #somelistdata -
"detail": "Method \"GET\" not allowed." in TokenAuthentication Django rest framework
I am trying to build a token-based authentication system by following https://www.django-rest-framework.org/api-guide/authentication/. But on sending a request, I am getting an error msg as a response: { "detail": "Method "GET" not allowed." } Here is what I have tried so far: urls.py urlpatterns = [ path('api-token-auth/', views.obtain_auth_token), ] models.py @receiver(post_save, sender=settings.AUTH_USER_MODEL) def create_auth_token(sender, instance=None, created=False, **kwargs): if created: Token.objects.create(user=instance) views.py def index(request): return render(request,'index.html') Any help would be beneficial. -
Use python packages from another docker container
How can I use python packages from another container? ydk-py is set up with everything that I need, including all python packages and their dependencies. I want to use those python packages in my django application. However python imports packages installed in my main container, web, and not ydk-py. docker-compose: version: '3.7' services: web: container_name: webserver build: . command: python manage.py runserver 0.0.0.0:8000 volumes: - .:/code/ ports: - 8000:8000 env_file: - .env.dev depends_on: - db db: container_name: database image: postgres:13.0-alpine volumes: - postgres_data:/var/lib/postgresql/data/ env_file: - .env.dev ydk-py: container_name: ydk-py image: ydkdev/ydk-py:latest tty: true volumes: postgres_data: Dockerfile: FROM python:3.6.12-alpine WORKDIR /code ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 RUN apk update && apk add jpeg-dev zlib-dev postgresql-dev gcc python3-dev musl-dev RUN pip install --upgrade pip COPY ./requirements.txt /code/requirements.txt RUN pip install -r requirements.txt COPY ./entrypoint.sh /code/entrypoint.sh COPY . /code ENTRYPOINT ["sh", "/code/entrypoint.sh"] -
Django Rest Framework - Validate email before updating
I need to add a condition in updating the user model. Here is my serializers.py class UserDetailsSerializer(serializers.ModelSerializer): email = serializers.EmailField() def validate_email(self, email): if User.objects.filter(email=email).exists(): raise serializers.ValidationError("Email exists") return email class Meta: model = User fields = __all__ Am I doing this right or I have to add an additional update function? I am new to Django and I'm not quite familiar yet with its structure and with the serializer and default functions. In this function, my goal is only to update the specific email value. the other values should be the same. -
Perform async task in view and return response before it's finished
Let's say I have a view like this in rest-framework which retrieves same data to be saved. class MyView(generics.CreateAPIView) def get(self, request): data = # logic to save data here. response data My question is if there's a neat solution to between saving the data and returning a response it's possible to make an asynchronous call to a method which will process some of the new data in the database. So I would like for Django to NOT wait for that method to finish running since that would make the response to the user very slow and it might time-out depending on server config. class MyView(generics.CreateAPIView) def get(self, request): data = # logic to save data here. # send async call to method which django does not wait for. response data -
How to use BlacklistView ('rest_framework_jwt.blacklist') in django
I need to implement logout in django project. For login I use JWT token(rest_framework_jwt). For logout I want to use BlacklistView, but I didn't find any examples how to implement it. Could someone provide me some example of usage BlacklistView? -
Not Found: /build/three.module.js Django and Threejs uploading a OBJ file
i would be very grateful if someone help me, i've traying upload a obj file with Django and threejs but i get this error:enter image description here 1: https://i.stack.imgur.com/ti131.png also i'm uploading images JPG and PNG too and this upload correctly but the obj imge doesn't work in my localhost. then, i don´t know if i'm importinting well the module or if my static files are wrong 'use strict'; import * as THREE from '../build/three.module.js' import { TrackballControls } from "../jsm/controls/TrackballControls.js"; import { MTLLoader } from "../jsm/loaders/MTLLoader.js"; import { OBJLoader2 } from "../jsm/loaders/OBJLoader2.js"; import { MtlObjBridge } from "../jsm/loaders/obj2/bridge/MtlObjBridge.js"; this is a part of my TrackballControls.js import { EventDispatcher, MOUSE, Quaternion, Vector2, Vector3 } from '../build/three.module.js'; {% load static %} <!DOCTYPE html> <html lang="en"> <head> <title>three.js webgl - OBJLoader2 basic usage</title> <meta charset="utf-8"> {% load static %} <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> <link rel="stylesheet" type="text/css" href="{% static 'css/site.css' %}" /> <style> #glFullscreen { width: 100%; height: 100vh; min-width: 640px; min-height: 360px; position: relative; overflow: hidden; z-index: 0; } #example { width: 25%; height: 50%; margin-top: 250px; margin-left: 1010px; background-color: #000000; } #feedback { color: darkorange; } #dat { user-select: none; position: absolute; left: 0; top: 0; z-Index: 200; } …