Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to debug a Django view through Heroku?
I found a bug in my web application and I am trying to debug one of my views through the LOGGER to visualize the results that my code is generating. This is the code implementation: import logging .... @login_required def retrieve_results(request): template_name = 'task/formRetrieval.html' status = 'In Progress' status_task = 'Active' logging.basicConfig(filename='std.log', filemode='w' format='%(asctime)s,%(msecs)d %(name) %(levelname)s %(message)s', level=logging.DEBUG) logger = logging.getLogger() qs_current = Task.objects.filter(accounts=request.user.id).values('id').values_list('id') logger.debug(str(qs_current)) ... The output is an empty std.log file, no result was logged. I am wondering if there's a permission problem that prevents my code from writing files into the heroku container. I even went a step further and I decided to create a txt file and I tried to log the results there but I only found an empty file. I have some questions: If Heroku is preventing me from creating a new file then is there a solution to indicate that logging files should be allowed? How can I indicate to Django to log a new file? Any help or suggestion is really appreciated :) Thank you -
How to query related object in DRF viewsets.ModelViewSet
I have a serialised model (Job) which I am using with datatables. The "Job" model is related to another model (Board) and here is where my problem is. I followed the doc here to filter jobs that are related to the "Board" model which is currently being viewed, but I can't get it to work as intended. models.py class Board(models.Model): name = models.CharField(_('board name'), max_length=256) slug = models.SlugField(_('unique url'), null=True, blank=True) ... class Job(models.Model): board = models.ForeignKey(Board, on_delete=models.CASCADE, verbose_name=_('board')) ... views.py class JobDataTablesViewSet(viewsets.ModelViewSet): queryset = Job.objects.all().order_by('-date_posted') serializer_class = JobDatatablesSerializer filter_backends = (DatatablesFilterBackend,) filterset_class = JobGlobalFilter def get_queryset(self): slug = self.kwargs['slug'] queryset = Job.objects.filter(slug=slug) return queryset urls.py path('<slug:slug>/', views.BoardPublicView.as_view(), name='public-board') -
How can perform a task from superuser in django
I am trying to perform an action from superuser accept/reject the task, but after login from superuser it show the error. even if i logged in from non superuser if show the same error 403 Forbidden i am trying first time perform action from superuser i don't know how can i fix this issue View.py from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin class Approval(LoginRequiredMixin, UserPassesTestMixin, TemplateView): def test_func(self): if self.request.user == User.is_superuser: return True else: return False template_name = 'approve.html' def get(self, request, *args, **kwargs): return render(request, self.template_name) def post(self, request): Urls.py urlpatterns = [ path('approve',Approval.as_view(), name='approve') ] -
search models in django admin
There is a model of orders, where new orders with information fall, photo1 Part of the information is the model of sneakers, sometimes these sneakers need to be corrected, now this is done in the form of TabularInline, photo2 and photo3, there are a lot of sneakers and it takes a very long time to scroll through this drop-down list, is there a way to make a search by entering text, like search_fields? -
Custom template not overriding PasswordResetConfirmView's template
I'm customising my password reset views and I can't seem to be able to override PasswordResetConfirmView's template through my urls.py file. This is what I have and according to other questions I looked at, it should be working. path("reset/<uidb64>/<token>/",auth_views.PasswordResetConfirmView.as_view(template_name="password_reset/password_reset_confirm.html"),name='password_creset_confirm'), My template is located on accounts/templates/password_reset/ . I have other templates there and they do override the default Django view. For example, this works: path("password_reset/done/", auth_views.PasswordResetCompleteView.as_view(template_name="password_reset/password_reset_done.html"), name="password_reset_done"), I have been able to receive my custom template if I move the template html to templates/register/ but I don't want to do this as I am trying to make the "accounts" app as independent as possible. Any ideas? I'm at a lost here. -
MIME type not serving or executing React+Django
I have an application written with Django as the backend and React as the front end. In development, everything works fine. However, in production I have these errors especially trying to use some javascript packages installed with npm. Refused to execute script from "" because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled. and Refused to apply style from "" because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled. my backend settings look like this settings.py BASE_DIR = Path(__file__).resolve().parent.parent DEBUG = True ALLOWED_HOSTS =['*'] INSTALLED_APPS = [ ... 'corsheaders', 'rest_framework', 'rest_framework.authtoken', 'appname', 'cart', 'storages', ] ... CORS_ALLOW_ALL_ORIGINS = True ... ROOT_URLCONF = 'backend.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, 'build')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', 'cart.context_processor.cart_total_amount' ], }, }, ] WSGI_APPLICATION = 'backend.wsgi.application' DATABASES = {'default': dj_database_url.config(conn_max_age=600)} ... STATIC_URL = '/static/' # STATIC_ROOT = BASE_DIR / "staticfiles" STATIC_ROOT = os.path.join(BASE_DIR, 'build','staticfiles') STATICFILES_DIRS = [ os.path.join(BASE_DIR, "build/static"), os.path.join(BASE_DIR, "public"), ] STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'build','media') DEFAULT_FILE_STORAGE = 'backend.aws_uploader.MediaStorage' dotenv_file = os.path.join(BASE_DIR, ".env") if os.path.isfile(dotenv_file): dotenv.load_dotenv(dotenv_file) django_heroku.settings(locals()) options = DATABASES['default'].get('OPTIONS', {}) options.pop('sslmode', None) i added this to my … -
Redirect user after login without using LOGIN_REDIRECT_URL but from views.py
I have a django app that I use auth_views.LoginView in settings.py for my login page. I want users that when they logged in, the redirect to a custom url without changing settings.py and from views.py. this is how my code work: def reserve_seat(request, movie_id, seat_id): if request.user.is_authenticated: print(request.user) new_ticket = Ticket( movie=Movie.objects.get(id=movie_id), user=request.user, seat=Seat.objects.get(id=seat_id) ) new_ticket.save() return redirect('list_seats', movie_id) else: return redirect('/login') I want users when they logged in , they redirects automatically to path('<int:movie_id>/seats', list_seats, name='list_seats'), this path How can I handle this? -
how to add autocomplete search api for 1 field in database in django rest framework
I have assignament which mentions autocomplete api design using DRF for search field of IFSC in my model. Here is what i have tried. the api shows results correctly but autocomplete doesnt work. views.py for autocomplete feature from django.shortcuts import render from .models import Branches, Banks from rest_framework import generics from rest_framework import viewsets from .serializers import BranchSerializer from .my_pagination import MyLimitOffsetPagination from rest_framework import viewsets from rest_framework.filters import SearchFilter, OrderingFilter # Create your views here. from dal import autocomplete class BankViewSet(viewsets.ReadOnlyModelViewSet): """ API endpoint that allows users to be viewed. """ queryset = Branches.objects.all() serializer_class = BranchSerializer pagination_class = MyLimitOffsetPagination filter_backends = [SearchFilter, OrderingFilter] search_fields = ['ifsc','branch','city','district','address','state'] ordering_fields = ['ifsc'] class IfscAutocomplete(autocomplete.Select2QuerySetView): def get_queryset(self): # Don't forget to filter out results depending on the visitor ! qs = Branches.objects.all() if self.q: qs = qs.filter(name__istartswith=self.q) return qs urls.py from django.contrib import admin from django.urls import path, include from rest_framework.routers import DefaultRouter from api import views from api.views import IfscAutocomplete # Create a router and register our viewsets with it. router = DefaultRouter() router.register('bankdetailapi', views.BankViewSet, basename='bankdetail' ) # The API URLs are now determined automatically by the router. urlpatterns = [ path('', include(router.urls), name='api'), path('api-auth/', include('rest_framework.urls', namespace='rest_framework')), path('admin/', admin.site.urls) ] models.py … -
Why does my http response keep showing like an html page?
Here's the thing: I thought I could receive an HTTP response and manage it with javascript ajax and do whatever I wanted with that response without the user even noticing. For example using console.log(response). But it's not working and the response is showing in text form like an html. I'll explain what I'm doing and my problem: I'm making a comment section for a django app. My comment system was working fine. The user could post comments and see other peoples comments. The thing is that I had to refresh the page every time to load the recently published comments. That's not very cool, I want to be able to post a comment and see it immediately without reloading the page. I did my research and found this comment on quora You use AJAX and a Django backend view. Something (a user leaving a new comment, a timer etc.) will trigger a JavaScript AJAX call to a Django view requesting comments for the page. That Django view will return the result to the JavaScript AJAX call. It can be done in two ways: it can just return the data, typically in JSON and then JavaScript worries about rendering that data … -
Django request.user.first_name not working in Safari
the code {{ request.user.first_name }} used on a HTML page with Django works perfectly in Chrome. However, it is not working in Safari and just displays nothing. Is there any alternative way of getting this or how can I fix this? Not using Safari is not an option as people with Safari will use this web-app. -
How to get JSON data from ajax request
I'm passing JSON back to my view from my html via ajax within ajax call team_ids = ['1'] //convert arrays into JSON var teamidarrayToString = JSON.stringify(Object.assign({}, team_ids)); var teamarrayJSON = JSON.parse(teamidarrayToString); var data = { teamarrayJSON: teamarrayJSON, 'csrfmiddlewaretoken': '{{ csrf_token }}', } $.ajax({ type: "POST", url: "/mypage/", data: data, success: function(data) { I'm not sure how to pickup teamarrayJSON within my views.py @login_required(login_url="/accounts/login/") def my_view(request): if request.is_ajax(): team_ids = request.POST.get("teamarrayJSON") print(team_ids) Print of team_ids is None. Can't figure out why. I printed (request.POST) and I can see the data. <QueryDict: {'teamarrayJSON[0]': ['1'], 'csrfmiddlewaretoken': ['bZefleNuHLAa']}> Thanks! -
AWS S3 is not working with Django showing AttributeError: 'str' object has no attribute 'copy'
STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static'),] STATICFILES_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage' #STATIC_URL = '/static/' #STATIC_ROOT = 'staticfiles' #STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATIC_URL = 'https://%s/%s/' % (AWS_S3_CUSTOM_DOMAIN, AWS_LOCATION) DEFAULT_FILE_STORAGE = 'core.storages.MediaStore' #MEDIA_URL = '/media/' #MEDIA_ROOT = os.path.join(BASE_DIR, 'media') Showing this error while expecting python manage.py collectstatic Type 'yes' to continue, or 'no' to cancel: yes Traceback (most recent call last): File "manage.py", line 22, in <module> main() File "manage.py", line 18, in main execute_from_command_line(sys.argv) File "/home/manish/workspace/gariya/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line utility.execute() File "/home/manish/workspace/gariya/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 413, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/manish/workspace/gariya/venv/lib/python3.6/site-packages/django/core/management/base.py", line 354, in run_from_argv self.execute(*args, **cmd_options) File "/home/manish/workspace/gariya/venv/lib/python3.6/site-packages/django/core/management/base.py", line 398, in execute output = self.handle(*args, **options) File "/home/manish/workspace/gariya/venv/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 187, in handle collected = self.collect() File "/home/manish/workspace/gariya/venv/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 114, in collect handler(path, prefixed_path, storage) File "/home/manish/workspace/gariya/venv/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 348, in copy_file self.storage.save(prefixed_path, source_file) File "/home/manish/workspace/gariya/venv/lib/python3.6/site-packages/django/core/files/storage.py", line 54, in save return self._save(name, content) File "/home/manish/workspace/gariya/venv/lib/python3.6/site-packages/storages/backends/s3boto3.py", line 437, in _save params = self._get_write_parameters(name, content) File "/home/manish/workspace/gariya/venv/lib/python3.6/site-packages/storages/backends/s3boto3.py", line 495, in _get_write_parameters params.update(self.get_object_parameters(name)) File "/home/manish/workspace/gariya/venv/lib/python3.6/site-packages/storages/backends/s3boto3.py", line 511, in get_object_parameters return self.object_parameters.copy() AttributeError: 'str' object has no attribute 'copy' even I appended static_root and media_root in urls.py ( url_patterns[]). please suggest what's wrong with the settings.py file or something. when I do collectstatic on my local its working fine. but … -
RuntimeError at /accounts/register/ There is no current event loop in thread 'Thread-1'
I want to implement an email verification in my django app so, I am using an external module verify_email in that there is a function called verify_email() to check whether an entered email address exists or not. In my view.py file I am checking if the mail is valid then a user is created but, the problem is the function verify_email() takes some time to get the result. I think we need to use some kind of await statement to wait for the result but I am getting errors like this when I try to use it normally. This is the pypi project link. def register(request): if(request.method == 'POST'): email = request.POST['email'] password = request.POST['pass'] username = request.POST['username'] check = verify_email(email) if check: user = User.objects.create_user(username,email,password) user.save() else: messages.info(request,'email invalid') return redirect('register') Is there a way to use asyncio or any other ways to deal with this kind of error? -
Django template: using forloop.counter as an index to a list
In a django template, I need to use forloop.counter0 to access an element in a list. For instance: {% for foo in bar %} <p>{{data[{{forloop.counter0}}]}}</p> {%endfor%} That notation doesn't work - I guet "cannot parse the remainder: [{{forloop.....]" So... how do I use the variable forloop.counter0 as an index for another variable (data) which is a list in a django template? -
In how many ways i can get ManyToMany field data using Django ORM
Let's assume I have a model named A and B. In model B I have ManyToMany field to model A so in how many ways I can get data from model A using model B class A(models.Model): name= models.CharField(...) class B(models.Model): a= models.ManyToManyField(A) -
Django localization in asynchronously sent emails and notifications
I have a django project that makes use of django-celery-beat and redis to make use of asynchronous messages. This is especially useful for handling sending many emails (for example, if an admin clicks a button, hundreds of emails have to be sent, without using celery/redis, this would take quite some time). It's almost the same for browser-notifications. I have set up a few cron tasks that fire notifications to useres depending on various variables. This all works fine, however, I am unable to find an elegant way for localizing the emails/notifications. I am somewhat familiar with how internationalization works within django, and for localizing direct responses and error messages, I am sending the accept-language flag (based on the current browser language) from my (angular) frontend. Django respects this (according to the docs) and this is working fine. However, when dealing with async tasks, there is no such thing as a request where django can look for a preferred language. When sending emails, I could pass the language from the accept-language field on to my async function, by setting the language within my function manually for each user (docs). This wont work for notifications, as they are sent by a cron … -
Django Error 404 when navigating between two templates in an app
I have a Django (v3.2) project with several apps. One of these apps (manage_remittance - see below) offers a list of items in the database (template remittance_view.html), and on the top of the list, there is a link leading to a form (template remittance_add.html) supposed to be used for adding new items. Here's the problem: I cannot navigate from remittance_view to remittance_add. I have spent entire day on this, and there must be something fundamentally wrong (with the project setup?), but I fail to see, what exactly. This is the error message I keep getting when I click on the link on the top of the list: Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/manage_remittance/remittance_add.html Using the URLconf defined in screentest_project.urls, Django tried these URL patterns, in this order: admin/ [name='login'] login/ [name='login'] logout/ [name='logout'] manage_remittance/ [name='remittance_view'] manage_remittance/ [name='remittance_add'] manage_settings/ export/ entity_setup/ ^static/(?P<path>.*)$ ^media/(?P<path>.*)$ The current path, manage_remittance/remittance_add.html, didn’t match any of these And, of course, I get the very same error message if type in a direct URL: http://127.0.0.1:8000/manage_remittance/remittance_add.html Same happens with http://127.0.0.1:8000/remittance_add.html and with http://127.0.0.1:8000/manage_remittance//manage_remittance/remittance_add.html File remittance_add.html is present under templates (even in two directories - same file) manage_remittance/templates/manage_remittance/remittance_add.html manage_remittance/templates/remittance_add.html remittance_view.html (the template from which I … -
Should I close db connection in child processes when using multiprocessing.apply_async()
I have code that seems to work, in which a process that spawns multiple processes and uses same db connection (without closing it in order to be reopened in each of the child-processes): import multiprocessing import os from django.db import connection def func(): # connection from parent process will be used in child process? print('{} {}'.format(os.getpid(), connection.cursor().execute('select 1'))) def main(): processes = 5 pool = multiprocessing.Pool(processes=processes) cursor = connection.cursor() cursor.execute('select 1') # connection was used before forking the process for i in range(10): pool.apply_async(func, ()) pool.close() pool.join() if __name__ == '__main__': main() I read here that if a process is forked, then each child process has to do connection.close() in order to make the connection be automatically reopened and get its own new file descriptor for a new db connection. The thing is that my code seems to work fine but I am not sure if it is indeed correct for production. So my question is: why I don't have to close connection when doing multiprocessing.apply_async()? Is the single connection from the parent process shared with all child processes? If yes then what's the different between apply_async and Process() techniques? -
поиск по названию модели из модели django [closed]
Есть модель заказов, куда падают новые заказы с информацией, фото1 Фото1 Часть инфы это модель кроссовок, иногда эти кроссовки нужно исправить, сейчас это сделано в виде TabularInline, фото2 и фото3, кроссовок много и листать этот выпадающий список очень долго, есть ли способ сделать поиск по вводу текста, как search_fields? Фото2 Фото3 -
iOS Universal Link: Django Python Support
I'm trying to integrate the universal link in my iOS app. In order to test, I configured a sample Django application on Heroku and added the apple-app-site association file to the root of the application. I have added the following line of codes to serve the apple-app-site-association file. GET request to domain_url/apple-app-site-association provides the following result { "applinks": { "apps": [], "details": [ { "appID": "XXXXXXXXXX.com.app.myapp", "paths": ["*"] } ] } } Following is the code in python that serves the request path = os.path.join(os.getcwd(), 'apple-app-site-association') with open(path , 'r') as myfile: data=myfile.read() response = HttpResponse(content=data) response['Content-Type'] = 'application/json' return response I tried the branch.io validator with my server URL and it was fine. But when I tried in https://search.developer.apple.com/appsearch-validation-tool/ I got the following response Error no apps with domain entitlements The entitlement data used to verify deep link dual authentication is from the current released version of your app. This data may take 48 hours to update. I configured the associated domain and updated the profiles. I tried opening the app on iPhone by clicking the link in both the mail app and notes app. But the link is opening to Safari, not the app. I tried reinstalling the … -
django rest framework generics.CreateAPIView for specific manytomany field
models.py class Author(models.Model): nickname = models.CharField(max_length=100) class Book(models.Model): title = models.CharField(max_length=255) authors = models.ManyToManyField(Author) serializer.py class BookSerializer(serializers.ModelSerializer): class Meta: model = Book fields = '__all__' views.py class AuthorBookCreateView(generics.CreateAPIView): queryset = Book.objects.all() serializer_class = BookSerializer ???? urls.py path('author/<str:pk>/create-book/', views.AuthorBookCreateView.as_view()) How can i define a new book for a specific author? -
django.template.loaders.app_directories.Loader won't search in installed_apps for templates
When the app is looking for templates, the django.template.loaders.app_directories.Loader loader won't look up for templates in apps it's only searching for templates in the virtual enviroment's libraries. On my windows machine it appears to be working fine however on linux it seems to be facing this issue. The html file I'm trying to render is in $PROJECT/main/Templates/index.html normally the loader should search for it. settings.py """ Django settings for testproject project. Generated by 'django-admin startproject' using Django 3.2.4. For more information on this file, see https://docs.djangoproject.com/en/3.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.2/ref/settings/ """ from pathlib import Path import os # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'django-insecure-$##t7qug+=d)poxawz=v3!7r@-70-z!qtmcp-qnq$s81*aj!fa' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = ['*'] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'main' ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'testproject.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR,"Templates")], 'APP_DIRS': True, 'OPTIONS': { … -
LOGIN_REDIRECT_URL
I have 2 apps which requir to login. But I dont know really how to set redirections for each app. I was following tutorial and both were using LOGIN_REDIRECT_URL, for one app it works excelent but for many it gives problem. When I press login in my "ecommerce" app, is redirecting me to "blog app" homepage as it's set in setting.py. How can I change redirections for each app? Or should I create new views for login ? My views from Blog: def register(request): if request.method == 'POST': form = UserRegisterFrom(request.POST) if form.is_valid(): form.save() username = form.cleaned_data.get('username') messages.success(request, f'Your account has been created! You are now able to login {username}!') return redirect('login') else: form = UserRegisterFrom() return render(request, 'users/register.html', {'form': form}) @login_required def profile(request): if request.method == 'POST': u_form = UserUpdateForm(request.POST, instance=request.user) p_form = ProfileUpdateForm(request.POST, request.FILES, instance=request.user.profile) if u_form.is_valid() and p_form.is_valid(): u_form.save() p_form.save() messages.success(request, f'Your account has been updated!') return redirect('profile') else: u_form = UserUpdateForm(instance=request.user) p_form = ProfileUpdateForm(instance=request.user.profile) context = { 'u_form': u_form, 'p_form': p_form } return render(request, 'users/profile.html', context) My views from ecommerce: if request.method == 'POST': form = UserCreationForm(request.POST) if form.is_valid(): user = form.save() login(request, user) vendor = Vendor.objects.create(name=user.username, created_by=user) return redirect('frontpage') else: form = UserCreationForm() return render(request, … -
What is the meaning of the Heroku deployment error message "conda_compile: line 7: conda: command not found"?
I am trying to deploy my django app in a conda virtual environment to Heroku. I am using the Heroku conda-buildpack by trib3. Trib3 says I can use both a conda-requirements.txt file for conda installed packages and a requirements.txt for pip installed packages. Everytime I try to deploy I get the same error message (see below) from Heroku, "conda_compile: line 7: conda: command not found." I have no idea what this means. Hence, I cannot fix the problem. Can someone please interpret this for me? Thanks, Jim [master 3b9e9e6] First deploy 2 files changed, 17 insertions(+), 68 deletions(-) rewrite conda-requirements.txt (76%) copy conda-requirements.txt => requirements.txt (71%) (cv_gw385) Jims-MBP:gw5-project jimbellis$ git push heroku master Enumerating objects: 463, done. Counting objects: 100% (463/463), done. Delta compression using up to 8 threads Compressing objects: 100% (453/453), done. Writing objects: 100% (463/463), 4.07 MiB | 51.00 KiB/s, done. Total 463 (delta 185), reused 0 (delta 0), pack-reused 0 remote: Compressing source files... done. remote: Building source: remote: remote: -----> Building on the Heroku-20 stack remote: -----> Using buildpack: https://github.com/trib3/conda-buildpack.git remote: -----> Python/Conda app detected remote: -----> Preparing Python/Miniconda Environment remote: /tmp/codon/tmp/buildpacks/999aa0b30e1056cc6f05c9dc7651fd0e6b8f5e08/bin/steps/conda_compile: line 7: conda: command not found remote: ! Push rejected, failed to compile … -
React component not rendering in django index html template
Index html: <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Babon</title> </head> <body> <div id="App"> <!-- React will load here --> </div> </body> {% load static %} <script src="{% static 'frontend/main.js' %}"></script> </html> Index.tsx: import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; ReactDOM.render( <App />, document.getElementById('App'), ); When I run my server I can see that the div is rendering with the "React will load here" message fine but my component doesn't seem to be rendering. Any ideas?