Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
RUNTIME ERROR IN PUT REQUEST DJANGO REST FRAMEWORK
I am trying to upload all user contacts to the server. Meaning if let's say a user registers on the app, the front-end takes all the phone contacts of the user and pushes it to the server so that it can be saved in database of the user. models.py Here in the user model, below you can see I put contact list as a Textfield, and I want to save only the giveName and phoneNumber of the user as a dictionary. class User(AbstractBaseUser,PermissionsMixin): phone = models.CharField(unique=True, max_length=20) username = models.CharField(max_length=50, unique=True) full_name = models.CharField(max_length=40) date_joined = models.DateTimeField(verbose_name='date_joined', auto_now_add=True) last_login = models.DateTimeField(verbose_name='last_login', auto_now_add=True) is_admin = models.BooleanField(default=False) is_active = models.BooleanField(default=True) is_staff = models.BooleanField(default=False) is_superuser = models.BooleanField(default=False) is_signedup_user = models.BooleanField(default=True) otp = models.CharField(max_length=10, default='') clubs_joined_by_user = models.CharField(max_length=5000, default="") number_of_clubs_joined = models.IntegerField(default=0) contact_list = models.TextField(default='') #this is the contact_list field, where I want user's contact details total_frames_participation = models.IntegerField(default=0) talked_to = models.CharField(max_length=1500,default='') USERNAME_FIELD = 'phone' REQUIRED_FIELDS = ['username', 'full_name'] #Since we created a manager for this Custom user model, which we use in the following way below. objects = MyAccountManager() def __str__(self): return self.username def has_perm(self, perm, obj=None): return self.is_admin def has_module_perms(self, app_label): return True serializers file ---> I did use a google's (phonenumbers) … -
Django.server logging configuration not working in Django Daphne
I wanted to increase logging level in order to decrease spam in logs with all 2XX responses. According to Django docs and other SO questions I have changed level of django.server logger to WARNING in settings.py. Unfortunately, this change does not work when I run my server using daphne. To verify, I ran my app using manage.py runserver and there the config was working. I've also tried changing log level (using LOGGING = {} in settings.py) of all loggers in logging.root.manager.loggerDict, also unsuccessfully. Anyone has some idea on how to either determine which logger logs the messages like presented below in daphne or how to force daphne to respect django.server log assuming it works as I expect? Sample log message I'm talking about: 127.0.0.1:33724 - - [21/Apr/2021:21:45:13] "GET /api/foo/bar" 200 455 -
How to craete Model Serialziers in django
I have models created and I need to work on Serialziers part. How do i create four tables in database. Table that I need: 1.OrderRoaster: fields = ( 'id', 'importDate', 'countOfOrders', 'importedBy', 'status') 2.OrderDetails: fields = ( 'id', 'detailSrl', 'orderDate', 'salesRep', 'customer', 'product', 'productTotal', 'serviceTotal', 'orderTotal', ) 3.OrderLineItem: fields = ( 'id', 'detailSrl', 'product', 'quantity', 'rate', 'discountPercentage', 'dutyPercentage', 'subTotal' ) models.py class OrderRoaster(models.Model): importDate = models.DateField(default=now) countOfOrders = models.PositiveIntegerField() importedBy = models.ForeignKey(Employee,on_delete=models.CASCADE) status = models.CharField(max_length=20) def __str__(self): return str(self.importedBy) + str(self.importDate) class ProductType(models.Model): productType = models.CharField(max_length=30) def __str__(self): return str(self.productType) class ProductSubType(models.Model): productType = models.ForeignKey(ProductType,on_delete=models.CASCADE) subType = models.CharField(max_length=20) def __str__(self): return str(self.subType) class Product (models.Model): productName = models.CharField(max_length=10) description = models.CharField(max_length=30) productSubType = models.ForeignKey(ProductSubType,on_delete=models.CASCADE) def __str__(self): return str(self.productName) class State(models.Model): stateName = models.CharField(max_length=10) stateCode = models.PositiveSmallIntegerField() def __str__(self): return str(self.stateName) class Address(models.Model): address_line_1 = models.CharField(max_length=30) address_line_2 = models.CharField(max_length=30) state = models.ForeignKey(State, on_delete=models.CASCADE) def __str__(self): return str(self.address_line_1) class OfficeLocation(models.Model): officeName = models.CharField(max_length=10) officeCode = models.CharField(max_length=10) address = models.ForeignKey(Address,on_delete=models.CASCADE) def __str__(self): return str(self.officeName) class CustomerType(models.Model): custType = models.CharField(max_length=20) def __str__(self): return str(self.custType) class Customer(models.Model): custName = models.CharField(max_length=20) address = models.ForeignKey(Address,on_delete=models.CASCADE) custType = models.ForeignKey(CustomerType,on_delete=models.CASCADE) def __str__(self): return str(self.custName) class OrderDetail(models.Model): orderRoaster = models.ForeignKey(OrderRoaster,on_delete=models.CASCADE) detailSrl = models.CharField(max_length=20) orderDate = models.DateField() salesRep = models.ForeignKey(Employee,related_name="salesRep",on_delete=models.CASCADE) admin … -
How to generate Django breadcrumbs automatically
I want to automatically make Django breadcrumbs and I tried too much and was unsuccessful. Is there any help? this is my template : <ul id="bread" class="breadcrumb"> <li class="breadcrumb-item"><a href="{% url 'home' %}">home</a></li> <li class="breadcrumb-item"><a href="{% url 'Categorie' %}">{{category_slug}}</a></li></li> </ul><br/> this is project urls : from django.contrib import admin from django.urls import path , include urlpatterns = [ path('' , include('Product.urls' ) ), path('admin/', admin.site.urls), ] this is my app urls : from django.urls import path from . import views urlpatterns = [ path('' , views.home, name='home' ), path('Product/Categorie_1/' , views.Categorie_1, name='Categorie_1' ), path('Product/Categorie_2/' , views.Categorie_2, name='Categorie_2' ), ] -
Encoding And Decoding File Field into bytes
I have the goal of changing the file object (video uploaded by user) to bytes and then chunking it and then changing these chunks again to images or frames. the following code is a snippet from a django app. def handle_uploaded_file(f): with open('./chunks_made.txt', 'wb+') as destination: for chunk in f.chunks(): print(type(chunk)) print(len(chunk)) destination.write(chunk) chunk_length = len(chunk) read_batches(len(chunk)) def read_batches(chunk_size): with open('./chunks_made.txt', 'rb') as file: content = file.read(chunk_size) frame = cv2.imdecode(content, cv2.IMREAD_COLOR) plt.imshow(frame) plt.show() The process view which calls these functions: def process(request): video_file = request.FILES['video'] handle_uploaded_file(video_file) data = 'some_data' return render(request, 'video/result.html', {'data':video_file}) I don't know how to decode the bytes into the frames as a real image. -
Serializer for invoices without foreignkey detail
I have this models of Order and a nested object OrderDetail. In the OrderDetail and don't want to save the reference to Product. I want to save the product data irself. So, I don't know how to build the serializer class Product(UUIDModel): name = models.CharField(max_length=10) price = models.DecimalField(max_digits=16, decimal_places=2, default=0.0) class Order(UUIDModel): order_name = models.CharField(max_length=10) class OrderDetails(UUIDModel): order = ForeignKey('Order', models.CASCADE, verbose_name=_('order')) product_name = models.CharField(max_length=10) product_price = models.DecimalField(max_digits=16, decimal_places=2, default=0.0) class OrderSerializer(serializers.ModelSerializer): class Meta: model = Order def create(self, validated_data): ... I use Formik to build the forms and I receive products uuid in the serializer. There is a simple way to build this kind of tipical problem ? -
Django Rest, How to update a single field of the object in viewset? I get IntegrityError for the required fields
Now I have a big catalog object and with one request I want to modify a single field of it.( The rest will remain the same). I have required fields so I get this error when I do PATCH request. null value in column "team_id" of relation "Catalogs_catalog" violates not-null constraint DETAIL: Failing row contains (ecf8ede4-1438-441b-8e45-152658512d27, null, [], {}, [], Europe/Moscow, t, null, ["a@a.com"]). I used viewset for catalog views and I added one more extra action to it so I can send a PATCH request to update the field. Views.py @action(methods=['patch'], detail=True, url_path='add_to_whitelist', url_name='add_to_whitelist') def add_to_whitelist(self, request, pk=None): catalog = self.get_object() users_to_add = request.data serializer = WhiteListUpdateSerializer(data=users_to_add, partial=True) if serializer.is_valid(): serializer.save() return Response({"message": "Saved the new white list."}, 201) return Response({"message":"Error creating white list.", "error": serializer.errors}, 400) Serializers.py class WhiteListUpdateSerializer(serializers.ModelSerializer): class Meta: model = Catalog fields = ('whitelist_users',) partial=True or rewriting partial_update didn't work. I am new to DRF, What is the thing I am missing here? -
Django ElasticSearch DSL: how to filter by a value in ListField
I have a number of fields in an ElasticSearch document MovieDocument created using django-elasticsearch-dsl. One of the fields is: actors = fields.ListField(fields.TextField()) This field in the ElasticSearch index contains a list of names, e.g.: ['Sylvester Stallone', 'Bruce Willis', 'Arnold Schwarzenegger']. And there are a number of other fields in the Document and the underlying Model. When a user performs a query searching 'Sylvester Stallone', I would like to retrieve this values from the ListField in a must clause. I.e. the search results should display only the movies featuring Sylvester Stallone, regardless of the other actors included in the actors list. I have tried dozens of combinations of queries and filters of django-elasticsearch-dsl but to no avail: I either get movies without Stallone or no movies at all. How can I achieve the desired result? -
How to return empty queryset from serializer.data Django Rest Framework
view.py class User_ListView(APIView): permission_classes = [DjangoCustomModelPermissions] queryset = User.objects.none() def get(self, request): param1 = request.query_params.get('param1',None) param2 = request.query_params.get('param2',None) try: db_data = User.objects.get(param1 = param1, param2=param2) serializer = User_Serializer(db_data) return Response(serializer.data) except Closing_Stock_List_Trans.DoesNotExist: db_data = User.objects.none() serializer = User_Serializer(db_data) return Response(serializer.data) serializer.py class User_Serializer(serializers.ModelSerializer): class Meta: model = User fields = '__all__' I want the serializer to return an empty response when no User DoesNotExist in the User Model, however I get the following error. How can i achieve this? AttributeError: Got AttributeError when attempting to get a value for field `param1` on serializer `User_Serializer`. The serializer field might be named incorrectly and not match any attribute or key on the `QuerySet` instance. Original exception text was: 'QuerySet' object has no attribute 'param1'. -
Django-React-Webpack Integration does not output updated React Components when I refresh the page
I have been trying to integrate React to a Django app using Babel and Webpack, but am having a hard time running the updated .js output file. I believe my problem comes from the main.js file Webpack outputs does not reflect the updated come from my React components. What I mean by that is that my server does not load the main.js file with the updated code when I refresh the page . What happens is that when I refresh the page only this runs on my python terminal (most of the time): [20/Apr/2021 22:01:02] "GET / HTTP/1.1" 200 1509. While sometimes my static files run too, but that seems to be random: [20/Apr/2021 22:00:20] "GET /%20static%20/frontend/main.js HTTP/1.1" 304 0. So what is happening is that the python server is rarely running GET for the static files when I refresh the page. I would like to understand why this happens and how I can fix it. Here is my folder structure: dist bundle.js main.js src components index.js static frontend main.js templates frontend index.html babel.config.json package.json webpack.config.js Here is my code: index.js - import App from "./components/App/App"; index.html <!DOCTYPE html> <html> <head> {% load static %} <link rel="icon" href="{% static 'imgs/acmLogo.ico' … -
How do I update a user created from another model though that model edits?
My question is based on this here. Now that User.objects.update_user() does not work, how would I update a user if the the teacher whose details created the user are updated. Below is the view that created the user. class NewTeacherView(LoginRequiredMixin,CreateView): model = TeacherData form_class = TeachersForm template_name = 'new_teacher.html' success_url = reverse_lazy('teachers') def form_valid(self, form): context = super().form_valid(form) teacher_data = self.object username = (teacher_data.first_name + teacher_data.last_name).lower() password = (teacher_data.first_name + str(teacher_data.code)).lower() user = User.objects.create_user( username=username, password=password, school_id=self.request.user.school.id, is_teacher=True) return context HHow would I create the view that edits the user when the teacher is edited???? -
KeyError in dictionary but key exists
I am having a problem with a keyerror, I know the key exists but i still get an error. Iam a beginner and i do not quite understand previous code examples of this question curr_coin = get(coin_url).json() keys in curr_coin.keys(): print(keys) PRINT RESULTS: id symbol name asset_platform_id platforms description description = curr_coin['description']['en'] Then i get this error Traceback (most recent call last): File "C:\Users\dan_t\anaconda3\envs\dtfinance\lib\site-packages\django\core\handlers \exception.py", line 47, in inner response = get_response(request) File "C:\Users\dan_t\anaconda3\envs\dtfinance\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "D:\Desktop\Algo\Django\dtfinance\website\views.py", line 255, in coins description = curr_coin['description']['en'] KeyError: 'description' I used : curr_coin.get('description') which fixed the problem but then key errors continue for the rest of that dictionary, why can i not access this dictionary like i usually have? Even through it is giving me a keyerror the description data is still output just fine and code works as it should. -
Python Social Auth - Ask user to type email if on facebook login
If facebook account have an email addres it's working fine and saving user with correct email address. I want to ask users while login with facebook to type their email address if the Facebook account is made with phone number. The users should type an email address in a form and then save the user account. How can I do that? -
Infrequent Heroku H10 Crashes on a deployed Django app that otherwise runs smoothly
I've been doing a lot of searching, and everything I can find regarding this error are deployment issues, which isn't my issue in this case. About 20 times a day, I will get a notification (I use Logentries) of a crash following the pattern of: 21 Apr 2021 12:42:05.218340 <158>1 2021-04-21T16:42:04.670611+00:00 heroku router - - at=error code=H10 desc="App crashed" method=PUT path="/api/warehouse/updateclient/" host=<HOST> request_id=cf9e8b49-d05c-4fca-a8ea-e07c93b888ce fwd="<IP ADDRESS>" dyno= connect= service= status=503 bytes= protocol=http I omitted sensitive information above. Now a few things to note: This app is running successfully and 99% of requests to this route work correctly (it receives 50K+ requests a day). This specific route /api/warehouse/updateclient/ is what is usually logged as the crash as it's the main endpoint for my API's client's updates (via Django Rest Framework), but this has also been logged on other routes as well, for example, an AJAX GET request on another route to update a status page. The Dyno does not reboot/restart during this, and all log entries before and after these crashes show the app to be running correctly (at the same endpoint), including the celery worker and the database updates. Often times within a second or so, it's responding to another request … -
python django latitude longitude filter in queryset
I have a field like class MyModel(models.Model): latitude = models.CharField(max_length=100, db_index=True) longitude = models.CharField(max_length=100, db_index=True) Lets say I have lat long value like myval = (27.66469717424158, 85.30983049711507) Here I want to find all the objects in MyModel which are less than 10 KM in distance from myval I looked into geopy library. I think it is useful after I get the data from queryset. How to achieve this ? -
How to add vertical bootstrap cards in django templates?
I want to add Bootstrap cards vertically, i am sending data from views.py and rendering it on template by iterating it using {% for %} loop. But I want those cards vertically card they are being placed one below another. Here's my html: <div class="card mb-3" style="max-width: 540px;"> <div class="row no-gutters"> <div class="col-md-4"> <img src="media/{{i.thumbnail}}" class="card-img" alt="thumbnail"> </div> <div class="col-md-8"> <div class="card-body"> <p class="card-title"><b>Title:</b> {{i.title}}</p> <p class="card-text"><b>Venue:</b> {{i.venue}}</p> <p class="card-text text-truncate"><b>Description:</b> {{i.description}}</p> </div> </div> </div> </div> I want output to be something like this -
Render html and load its css/js files without using static files from Django
I am trying to render a html using a local directory but I keep getting the error: The resource from "/path/to/js/" was blocked due to MIME type ("text/html") mismatch (X-Content-Type-Options: nosniff)". I believe I am getting this error because I am not using the staticfiles that django says to use. But that is exactly what I want to not do. Basically, I have an app that exports presentation slides in HTML format, but it puts the js files and css files in its own directory which has a completely different structure than Django's staticfiles. I wanted to know if there was a way I could render the page and get its js/css to make it work. I was able to get the html from the other directory but that's where it stops and gives me an error. Thanks. -
can't access views with IsAuthenticated even if logged in (django rest framework + simple jwt)
iam trying to make DRF working with Simple-jwt. so far it is working , register users and logging except if i try to access a view with IsAuthenticated permission it still ask for credentials, and i can't put my hand on what i am missing here. if i want to acces ListUsers view i get : "detail": "Authentication credentials were not provided." views: class CustomUserCreate(APIView): permission_classes = [AllowAny] def post(self, request, format='json'): serializer = CustomUserSerializer(data=request.data) if serializer.is_valid(): user = serializer.save() if user: json = serializer.data return Response(json, status=status.HTTP_201_CREATED) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) class LoginAPIView(APIView): permission_classes = (AllowAny,) serializer_class = LoginSerializer def post(self, request, data=None): serializer = self.serializer_class(data=request.data) serializer.is_valid(raise_exception=True) return Response(serializer.data, status=status.HTTP_200_OK) class ListUsers(APIView): permission_classes = (IsAuthenticated,) def get(self, request, format=None): usernames = [user.user_name for user in NewUser.objects.all()] return Response(usernames) serializers: class CustomUserSerializer(serializers.ModelSerializer): email = serializers.EmailField(required=True) user_name = serializers.CharField(required=True) password = serializers.CharField(min_length=8, write_only=True) class Meta: model = NewUser fields = ('email', 'user_name', 'password') extra_kwargs = {'password': {'write_only': True}} def create(self, validated_data): password = validated_data.pop('password', None) # as long as the fields are the same, we can just use this instance = self.Meta.model(**validated_data) if password is not None: instance.set_password(password) instance.save() return instance class LoginSerializer(serializers.Serializer): email = serializers.CharField(max_length=255) user_name = serializers.CharField(max_length=255, read_only=True) password = … -
'TemplateDoesNotExist' can't get the solution
I am starting in Django, but I am stuck with this problem I have this structure in my VSCode Workspace -Project1 __pycache__ __init__.py asgi.py settings.py urls.py views.py wsgi.py -templates mytemplate.html db.sqlite3 manage.py I am trying to use a template that I built urls.py from Project1.views import salute urlpatterns = [ path('admin/', admin.site.urls), path('salute/', salute), ] views.py from django.template.loader import get_template from django.shortcuts import render class Persona(object): def __init__(self, nombre, apellido): self.nombre = nombre self.apellido = apellido def salute(request): p1=Persona('Peter', 'Parker') temas_del_curso = ['Plantillas', 'Modelos', 'Formularios', 'Vistas', 'Despliegue'] fecha_de_hoy = datetime.datetime.now() return render(request, 'miplantilla.html', { 'nombre_persona' : p1.nombre, 'apellido_persona' : p1.apellido, 'fecha_de_hoy' : fecha_de_hoy, 'temas' : temas_del_curso }) They suggest I copy the directory path where my template is saved settings.py TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': ['C:/Users/machine/Desktop/Django/Project1/templates'], 'APP_DIRS': True, } Someone please help me, I have tried everything and still can't find the solution. Also use the form Django suggests 'DIRS': BASE_DIR / 'templates' and the form [os.path.join (BASE_DIR, 'templates')] but the error continues -
Django Environ: SMTPServerDisconnected when managing email password
I just installed Django-Environ to store my email password (more specifically, Sendgrid's API key). Sending emails worked well before but I now get an error SMTPServerDisconnected at /... Connection unexpectedly closed. Settings.py import environ env = environ.Env() environ.Env.read_env() ... EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'smtp.sendgrid.net' EMAIL_PORT = 587 EMAIL_USE_TLS = True EMAIL_HOST_USER = 'apikey' EMAIL_HOST_PASSWORD = env.str('SENDGRID_API_KEY') .env file in the same directory as my settings.py project_name/ .env asgi.py settings.py urls.py wsgi.py .env SENDGRID_API_KEY=SG.TUU5oTWg...... The weird thing is if I print(EMAIL_HOST_PASSWORD) in my settings, the value imported is not even the same as the one stored in my .env file; as if it was distorted during the import. I've also tried to stringify the output with .str but the outcome is the same. Any thoughts as to what is causing this? -
Django-Debug-Toolbar is not showing
I am building BlogApp and I am trying to run Django-Debug-Toolbar BUT it is not showing. I have seen many answers BUT nothing worked for me. I have installed it correctly according to the Documentation I have added in installed apps , middlewares and urls and also collecstatic. BUT still not showing when i go to Browser. settings.py if DEBUG: MIDDLEWARE += [ 'debug_toolbar.middleware.DebugToolbarMiddleware', ] INSTALLED_APPS += [ 'debug_toolbar', ] INTERNAL_IPS = ['127.0.0.1', ] # this is the main reason for not showing up the toolbar import mimetypes mimetypes.add_type("application/javascript", ".js", True) DEBUG_TOOLBAR_CONFIG = { 'INTERCEPT_REDIRECTS': False, } urls.py if settings.DEBUG: import debug_toolbar urlpatterns += [ path('__debug__/', include(debug_toolbar.urls)), ] Any help would be Appreciated. Thank You in Advance -
How efficient is Django Core Pagination?
I have a query set of some 500 objects... which I get after running the initial query set in some loops and checking a few conditions and excluding the objects that do not meet the criteria... and I am displaying these objects using Django core pagination.. how efficient is this and if not, what are the alternatives. -
IntegrityError at /admin/product/product/add/ FOREIGN KEY constraint failed
I was trying to make a product model and when i tried to add it for testing from my admin panel i got this error but i have not used any foreignkey in this model.Thanks for helping.I am writing just because stack overflow is not allowing me to post by saying you have very less description Exception Type: IntegrityError at /admin/product/product/add/ Exception Value: FOREIGN KEY constraint failed My Model.py class Product(models.Model): name=models.CharField(max_length=100,null=False,blank=False) price=models.DecimalField(max_digits=10,decimal_places=2) excerpt=models.CharField(max_length=150) description=models.TextField() stock=models.IntegerField() discount=models.FloatField(null=True,blank=True) slug=models.CharField(max_length=255,null=True,blank=True) brand=models.CharField(max_length=100) featured=models.BooleanField(default=False) main_image=models.ImageField(upload_to='product/') sub_image_1=models.ImageField(upload_to='product/',null=True,blank=True) sub_image_2=models.ImageField(upload_to='product/',null=True,blank=True) sub_image_3=models.ImageField(upload_to='product/',null=True,blank=True) uploaded_at=models.DateTimeField(auto_now_add=True) class Meta: ordering=['-uploaded_at'] def __str__(self): return self.name # def save(self,*args,**kwargs): # if self.slug is None: # self.slug=slugify(self.name) # super(Product, self).save(*args, **kwargs) def featured_8_products(self): return self.objects.filter(featured=True)[:8] def latest_8_products(self): return self.objects.all()[:8] -
When running my Django application on a Docker container: psycopg2.OperationalError: could not translate host name
Some is either wrong with my docker-compose or Docker in general. When running python manage.py runserver it works perfectly. But when after I build my docker-compose, and run it with docker-compose up, I get the following error: psycopg2.OperationalError: could not translate host name "<AWS_DB_URL>" to address: Name does not resolve This is my Dockerfile: FROM python:3.8-alpine ENV PATH="/scripts:${PATH}" COPY ./requirements.txt /requirements.txt RUN apk add --update --no-cache --virtual .tmp gcc libc-dev linux-headers RUN apk add postgresql-dev RUN apk add jpeg-dev zlib-dev RUN python -m pip install -U --force-reinstall pip RUN pip install -r /requirements.txt RUN apk del .tmp RUN mkdir /app COPY ./backend /app WORKDIR /app COPY ./scripts /scripts RUN chmod +x /scripts/* RUN mkdir -p /vol/web/media RUN mkdir -p /vol/web/static CMD ["entrypoint.sh"] This is my docker-compose.yml: version: '3.7' services: app: build: context: . ports: - "8000:8000" volumes: - ./backend:/app command: sh -c "python manage.py runserver 0.0.0.0:8000" environment: - DEBUG=1 - AWS_ACCESS_KEY_ID=<AWS_ACCESS_KEY_ID> - AWS_SECRET_ACCESS_KEY=<AWS_SECRET_ACCESS_KEY> This is my entrypoint.sh #!/bin/sh set -e python manage.py collectstatic --noinput uwsgi --socket :8000 --master --enable-threads --module app.wsgi This is my error: app_1 | Watching for file changes with StatReloader app_1 | Exception in thread django-main-thread: app_1 | Traceback (most recent call last): app_1 | File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", … -
'base' template between Django and Bokeh
I am learning Bokeh and want to embed it in a Django app. Particularly, I want to insert a series of charts created with Bokeh into a Django website. Bokeh templates look similar to Django. But all of them are supposed to extend a base template inherent to Bokeh. And on Django site, its templates are also supposed to extend a base.html created by ourselves. How should I handle this, or what to make of this situation? Thanks.