Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django + React Axios Network Error: Access-Control-Allow-Credentials expected 'true'
I am working on a web app running React on the front end and Django on the back end and am running into a issue when sending api requests to the back end. When attempting a POST or GET request, there occurs a Axios Network Error popping up on the site reading: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8000/is_authenticated/. (Reason: expected ‘true’ in CORS header ‘Access-Control-Allow-Credentials’). Nevertheless, when inspecting the network request in Firefox, the JSON response does contain the correct data and has a 200 OK status. Just a warning appears "Response body is not available to scripts (Reason: CORS Missing Allow Credentials)". My current backend settings using CorsMiddleware are INSTALLED_APPS = [ ... 'app', 'corsheaders', 'rest_framework', ... ] MIDDLEWARE = [ ... 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', ... ] CORS_ALLOW_CREDENTIALS: True CSRF_COOKIE_SECURE = False, CORS_ORIGIN_ALLOW_ALL = False CORS_ALLOWED_ORIGINS = [ 'http://127.0.0.1:3000', 'http://127.0.0.1:8000', 'http://localhost:3000', 'http://localhost:8000', ] When sending the request I have the current axios post call. axios.post(`http://localhost:8000/login/`, request, { withCredentials: true }) .then(({ data }) => { if (data.warning) return; localStorage.setItem("currentUser", data.user); }); Is there a setting I am overlooking or specific error in my code? Or are there certain front-end settings on Axios … -
How to log in the celery log, outside celery tasks (inside a django view)?
Suppose an endpoint in a django project def my_view(request, my_id): if is_request_valid(request): logger = logging.getLogger('celery.task') logger.info('Starting a task for a thing with ID %i', my_id) my_cool_task.apply_async() Now, according to the celery docs this may log, since A special logger is available named “celery.task”, you can inherit from this logger to automatically get the task name and unique id as part of the logs. But it works only inside a task. Also, I did play with setting some logging variable inside settings.py, and then reassigning the celery's logging. Did play with the CELERY_WORKER_HIJACK_ROOT_LOGGER, but even when I use the root logger, the logs do not appear in the console. Nor using getLogger("celery") does not help. This seems like a simple thing to do, but I'm struggling all day to do this, please help. -
Why doesn't request.POST show values added using javascript after django form has been rendered
I am trying to update a django form according to user clicks. I allow the user to add more form tags on the DOM by clicking a button, add a value to it and submit when the user is done. I have used modelForm to build the initially part of the form which was rendered in the template. But when the form is submitted it only shows values that are part of the ReportForm class which inherits forms.ModelForm. Here is my report class: class ReportForm(forms.ModelForm): date_resolved = forms.DateField(widget=forms.DateInput(attrs={ 'name': 'date_resolved', 'type': 'date', }), label="Date resolved (ignore if not):") bias_score = forms.IntegerField(widget=forms.NumberInput(attrs={ 'type': 'range', 'width': '100%', 'value':0, 'min': 0, 'max': 10, 'step': 1, 'style': "padding: 0;" }), label="Bias Score (between 0 and 10)") class Meta: model = Reports fields = ['date_resolved', 'tags', 'bias_score'] and this is what the report class looks like class Reports(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) conversation = models.ForeignKey(Conversations, on_delete=models.CASCADE) tags = models.ManyToManyField(Tags, null=True, blank=True) bias_score = IntegerRangeField(min_value=1, max_value=10) resolved = models.BooleanField(default=False) date_resolved = models.DateField(blank=True, null=True) date_added = models.DateField(auto_now_add=True) The javaScript is bit long but here is the most importtant part: function create_tags(){ let label_text_content = null if (IS_PROMPT == true){ IS_PROMPT = false INPUT_COUNTER +=1 label_text_content = 'Prompt:' … -
in Django admin page. How can the entry be changed based on a change in the value of a field?
i use django 5 and i have this code when i choice 'D' the doctor field must active if i change to 'H' the doctor must deactive and hospital become active and so class InputMovment(models.Model): SOURCE_MOVE = { 'D':_('doctor'), 'H':_('hospital'), 'C':_('company'), 'O':_('other'), } source = models.CharField( max_length=1, choices=SOURCE_MOVE, default='D', verbose_name=_("source"), db_index=True) move_number = models.CharField(max_length=20, db_index=True, verbose_name=_('number')) doctor = models.ForeignKey('Doctor', null=True, blank=True, on_delete=models.CASCADE, verbose_name=_('اdoctor')) hospital = models.ForeignKey('Hospital', null=True, blank=True, on_delete=models.CASCADE, verbose_name=_('اhospital')) company = models.ForeignKey('Company', null=True, blank=True, on_delete=models.CASCADE, verbose_name=_('اcompany')) persone = models.CharField(max_length=50, null=True, blank=True, db_index=True, verbose_name=_('other')) description = models.TextField(verbose_name=_('description')) I tried to find a function to change the field, like change_field or something like that but I could not find it Does anyone have any idea for a solution? -
(Django) My function runs twice for no reason
this is my view: def add_to_cart (request, pk): item = models.Product.objects.get(product_id = pk) user = request.user custom_user = models.CustomUser.objects.get(user = user) cart = models.Cart.objects.get(user = custom_user) if cart_products == "": cart.products = f"{str(pk)}={item.product_name}={item.product_price}" else: cart.products += f":{str(pk)}={item.product_name}={item.product_price}" print(cart.products) print(cart) cart.save() return redirect("/") And this is my url: path('products/add-cart/<pk>', views.add_to_cart, name="add_to_cart") Pretty simple. But when I visit 127.0.0.1:8000/products/add-cart/1 url, If it is my first visit for this url (which means if cart_products == "" is True, It works alright and this happens: Then, when I visit url for second time, then this happens: This is very weird because it added 2 more products. The thing is, it adds 1 or 3 sometimes. Absolutely not stabil. This is very weird and my code is very simple. I can not understand it. -
Why does this appear when run my server in django?
Why do I get the following when I run my server in VS code? This is my project file views urls.py in demo urls.py in myapp setting settings The site when I run python manage.py runserver I have tired almost everything from creating a new urls file in myapp, deleting the old one to eating paper. Yes myapp is added in setting. I am running this in VS code. Can someone help figure out the problem? -
Problem with signals logedd_in and logedd_out
signals.py from django.contrib.auth.signals import user_logged_in, user_logged_out from django.dispatch import receiver print("import nice") @receiver(user_logged_in) def login_logged_in(sender, request, user, **kwargs): print("login nice") @receiver(user_logged_out) def login_logged_out(sender, request, user, **kwargs): print("logout nice") "import nice" is shown on the console. "login nice" is not shown on the console. "logout nice" is not shown on the console. apps.py from django.apps import AppConfig class ApplicationConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'application' def ready(self): print("ready nice") import application.signals "ready nice" is shown on the console. init.py default_app_config = 'application.apps.ApplicationConfig' import application.signals What could be happening? pls help me I use debug messages to identify which function is not running correctly -
Django rest session authentification postman
I've customised django auth method: class MyBackend(ModelBackend): def authenticate(self, request, phone=None, otp=None, **kwargs): UserModel = get_user_model() try: user = UserModel.objects.get(phone=phone) except UserModel.DoesNotExist: return None else: if user.otp == otp: # user.otp = None # user.save() return user def get_user(self, phone): UserModel = get_user_model() try: return UserModel.objects.get(phone=phone) except UserModel.DoesNotExist: return None My authentication class: class ValidateOTP(APIView): def post(self, request): phone = request.data.get('phone', None) otp = request.data.get('otp', None) if not phone or not otp: return Response({'error': 'Wrong data.'}, status=status.HTTP_400_BAD_REQUEST) user = authenticate(request, phone=phone, otp=otp) login(request, user) return Response({'Ok': 'ok'}, status=status.HTTP_200_OK) With postman I create user by endpoint http://127.0.0.1:8000/api/validate-otp/ . Everything is ok. But when I try to GET request to another endpoint, my request.user is Anonymous. class UserInfo(APIView): permission_classes = ([IsAuthenticated]) def get(self, request): print(request.user) return Response({'ok': 'ok'}, status=status.HTTP_200_OK) What can be a problem? -
Send notification of task assignments by email?(Django)
I am working on a kanban project. When a task is created, I want to send a notification mail to the employees assigned to the task. When a registration signal comes to my model, I capture it and get the assignees data from the information about the created task, but this data returns empty. When I check via Django Admin, the data seems to exist. When I check with Breakpoint, the data comes, but there is no data in the process I do with signal capture. In a little research, I learned that it may be caused by a problem such as assignees data not coming immediately, but I could not find anything about the solution. If anyone has any ideas, I am waiting, I shared sections of my code with you. models.py from django.db import models from account.models import User from django.dispatch import receiver from django.db.models.signals import post_save from inupmt_be.utils import send_task_email class Priority(models.TextChoices): LOW = 'low', 'Düşük' MEDIUM = 'medium', 'Orta' HIGH = 'hight', 'Yüksek' class Column(models.Model): title = models.CharField(max_length=100) priority = models.PositiveSmallIntegerField() def __str__(self): return self.title class Labels(models.Model): title = models.CharField(max_length=100) def __str__(self): return f'{self.title}' class Task(models.Model): reporter = models.ForeignKey(User, related_name='reported_tasks', on_delete=models.CASCADE) assignees = models.ManyToManyField(User, related_name='assigned_tasks') column … -
In Django Admin, adding a model as a tab
I am trying to sort out my admin site for my django application. I have a lorcana_sets table and a lorcana_sets_cards table. lorcana_sets_cards has a foreign key to lorcana_sets via set_id field. If I add the follow: # Lorcana Sets - Cards class LorcanaSetsCards(admin.ModelAdmin): list_display = ['name'] list_display_links = ['name'] admin.site.register(lorcana_sets_cards, LorcanaSetsCards) I get a table that lists all the cards and I can click on the name of the card in the list and be taken to the card object where I am able to edit that card object's fields. Now I have created the following where I have the table of sets and when I click into the set object there is a Lorcana Cards tab that contains a table which lists all of the cards in that set. class LorcanaSetsCardsInline(admin.TabularInline): model = lorcana_sets_cards extra = 0 fields = ['id', 'number', 'full_name', 'hidden', 'manual'] readonly_fields = ['id', 'number', 'full_name'] @admin.display(description='Name') def full_name(self, obj): return f"{obj.name} - {obj.subtitle}" if obj.subtitle else obj.name def get_queryset(self, request): qs = super().get_queryset(request) qs = qs.annotate(number_as_int=Cast('number', output_field=IntegerField())).order_by('number_as_int') return qs # Lorcana Sets class LorcanaSets(admin.ModelAdmin): list_display = ['code', 'name', 'type', 'release_date'] list_display_links = ['name'] search_fields = ['code', 'name', 'type'] ordering = ['-release_date'] inlines = [LorcanaSetsCardsInline,] … -
why do i get this Maximum Recursion Error
RecursionError at /ads/ad/create/ maximum recursion depth exceeded Request Method: GET Request URL: https://bydesign.pythonanywhere.com/ads/ad/create/ Django Version: 4.2.7 Exception Type: RecursionError Exception Value: maximum recursion depth exceeded Exception Location: /home/bydesign/.virtualenvs/django5/lib/python3.10/site-packages/django/template/loaders/cached.py, line 47, in get_template Raised during: ads.views.PicCreateView Python Executable: /usr/local/bin/uwsgi Python Version: 3.10.5 Python Path: ['/home/bydesign/django_projects/mysite/mysite', '/var/www', '.', '', '/var/www', '/usr/local/lib/python310.zip', '/usr/local/lib/python3.10', '/usr/local/lib/python3.10/lib-dynload', '/home/bydesign/.virtualenvs/django5/lib/python3.10/site-packages'] Server time: Sat, 20 Apr 2024 10:29:56 -0500 Error during template rendering In template /home/bydesign/.virtualenvs/django5/lib/python3.10/site-packages/django/forms/templates/django/forms/widgets/text.html, error at line 1 maximum recursion depth exceeded 1 {% include "django/forms/widgets/input.html" %} 2 i ran through all my files there's no syntax errors or logical errors. The error keeps pointing to a file that doesn't even exist so i created it hoping that would solve the issue. I used grep commands --nothing -- i used shell to try to pinpoint the issue --nothing yet i get this error. Im just a student , a newbie, so green i glow!! Need help please. -
Deploy Tensorflow MoveNet for (near) real-time pose estimation
For a school project we are creating an application that performs pose estimation on children doing physical tests. Children are filmed using tablets. The frames get sent to a server for processing since the tablets are not powerfull enough to do the pose estimation. The server then performs the pose estimation using Tensorflow MoveNet Thunder and sends some data back to the tablet. Currently we use Django server side and have a react-native app running on the tablets. For the communication, we set up a websocket between the tablet and the server to send the frames from the tablet to the server and send the data from the server to the tablet. The frames are base64 encoded before transmission. const base64Image = data.toString('base64'); const message = { 'frame_index': i, 'frame': base64Image, 'is_last_frame': i === amountOfFrames, 'test_child_id': test_child_id }; // console.log("Sending message:", message) // Send to websocket with the image data jumping_sidways_socket.send(JSON.stringify(message)); We know notice that the transmission of the frames to the server is responsible for the biggest part of the delay making it difficult to have near real-time processing of the frames. The question if it is possible to increase the transfer speed? -
Problem with displaying the object. Django
I want display post in my group(separate posts for each group). I separated posts in main page successfully (before when i created post in group form post display in mainpage). The post is assigned to group in admin site and DB I can create this but i cant display. I don't have error page working. <a href="{% url 'group_post' group.pk %}" class="submit-style">Dodaj post</a> {% for post in post_list %} class PostGroupListView(ListView): model = Post template_name = 'rooms/group_detail.html' context_object_name = 'post_list' def get_queryset(self): group_id = self.kwargs['group_id'] return Post.objects.filter(group_id=group_id) class PostGroupCreateView(LoginRequiredMixin, CreateView): model = Post fields = ['content', 'image'] def form_valid(self, form): group_id = self.kwargs.get('group_id') form.instance.author = self.request.user group = get_object_or_404(Group, id=group_id) form.instance.group = group return super().form_valid(form) class GroupPostDetailView(DetailView): model = Post context_object_name = 'group_post' def some_view(request, post_id): post = get_object_or_404(Post, pk=post_id) return render(request, 'group_detail.html', {'post': post}) Post Display in group class GroupDetailView(DetailView): model = Group context_object_name = 'group' template_name = 'rooms/group_detail.html' pk_url_kwarg = 'group_id' def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['form'] = AddGroupMemberForm(group_id=self.object.id) context['members'] = GroupMembers.objects.filter(group=self.object) #Download all members context['post'] = Post.objects.filter(group=self.object) return context -
How to use variable instead of giving field in filter queryset django
if I have a class like this: class Name: field1 = ... field2 = ... ... and base on some if I have to filter them with field1 or 2 and I have them from input in variables? if name is an instance of Name ,I want name.objects.filter(key=value) not name.objects.filter(field1=value) i want to use this on different classes and fields so if is not what I want. raw() always triggers a new query and doesn’t account for previous filtering but I need them all and I have to filter one by one! -
how to log request id in django middleware?
I write some code as below,but it raise an exception here is request_id_middleware.py import uuid from django.middleware.common import CommonMiddleware from taiji.logger import logger class RequestIDMiddleware(CommonMiddleware): # pass def process_request(self, request): request.META['request_id'] = str(uuid.uuid4()) logger.info(f"start request id: {request.META['request_id']}") return request def process_response(self, request, response): if request.META.get('request_id') is None: response.headers['X-REQUEST-ID'] = request.META['request_id'] logger.info(f"finish request id: {response.headers['X-REQUEST-ID']}") return response logger.py import logging def set_logger(name): logger=logging.getLogger(name) handler=logging.StreamHandler() handler.setLevel(logging.DEBUG) fmt=logging.Formatter(fmt='%(asctime)s - %(name)s - %(levelname)s - %(message)s') handler.setFormatter(fmt) logger.addHandler(handler) return logger logger=set_logger('gg') views def index(request: HttpRequest): logger.info("hello world") return JsonResponse("hello world") but it tell me Traceback (most recent call last): File "E:\miniconda\envs\py312\Lib\wsgiref\handlers.py", line 137, in run self.result = application(self.environ, self.start_response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\miniconda\envs\py312\Lib\site-packages\django\contrib\staticfiles\handlers.py", line 80, in __call__ return self.application(environ, start_response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\miniconda\envs\py312\Lib\site-packages\django\core\handlers\wsgi.py", line 124, in __call__ response = self.get_response(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\miniconda\envs\py312\Lib\site-packages\django\core\handlers\base.py", line 141, in get_response response._resource_closers.append(request.close) ^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'WSGIRequest' object has no attribute '_resource_closers' [20/Apr/2024 22:32:59] "GET /index/ HTTP/1.1" 500 59 is it right way to implement a middleware? why it call a WSGIRequest error? it should be a respone-like object error Any help will be appreciate -
Authentication and Resource Server Infrastructure
I have been tasked with designing the infrastructure of our backend systems for a project. Simply we have have a Django API Service with a accouple of endpoints to manage a user profile. We will also need a Authentication Server that we manage onsite. The idea would be to host the Authentication Server probably using OAuth2.0 with Django behind our firewall, and than use the public facing API to make calls to that server for Authenticating. Does this general infrastructure make sense? Should both of these Servers share the same DB, or should there be a AuthDB and a ResourceDB? I have tried researching and there are so many different routes people go with something like this, and I have no idea if I have the right approach yet. -
RESTful API (Django) best practices for admin and normal user access
hello i am working on mobile app that is show for the users to invest on properties and my question is when i implement the APis for the normal user and the admin am i need to make separate APIs for each app because the admin can see and make all operations in the admin dashboard and the normal user can also see the list of all the properties ,get the payment methods and so on.. but on the mobile app not on the admin dashboard example : 1-admin dashboard :http://127.0.0.1:8000/dashboard/api/properties-list/ http://127.0.0.1:8000/dashboard/api/cart-list/ http://127.0.0.1:8000/dashboard/api/cart-update/ and the rest of the APIs 2-mobile app :http://127.0.0.1:8000/mobile/api/properties-list/ http://127.0.0.1:8000/mobile/api/cart-list/ http://127.0.0.1:8000/mobile/api/cart-update/ and the rest of the APIs is that is the best practice for ensuring that the normal user can access the list of the properties from the admin dashboard ? am i try to solve problem that facing me and my expected to have result for my question -
How to fill all input fields automatically from database by entering input in one textbox using django?
I am trying to create a form, where the form details can be autofill from the database by inputting a field in the form using django I was able to see it done in javascript, but i don't know how to connect it to my views.py in django -
Django Object id's passed to the template are not the same inside the view
When I am submitting the form, the question id's that are inside the view do not match with the question id's from the request.POST. When submitting the from, the print statements from the view below are: <QueryDict: {'csrfmiddlewaretoken': ['token here'], 'question_15': ['option1'], 'question_17': ['option1']}> question_4 question_5 Inside the request.POST the id's are 15 and 17, and inside the view 4, 5. Everytime i am submitting the form, the id's do not match. View: @login_required def quiz_view(request): questions = QuizQuestion.objects.order_by('?')[:2] user = request.user if request.method == 'POST': print(request.POST) for question in questions: input_name = f"question_{question.id}" print(input_name) option_selected = request.POST.get(input_name) if option_selected: # Check if the user has already responded to this question existing_response = QuizUserResponse.objects.filter(user=user, question=question).first() if existing_response: # Update existing response existing_response.response_text = getattr(question, option_selected) existing_response.save() else: # Create new response QuizUserResponse.objects.create(user=user, question=question, response_text=getattr(question, option_selected)) return redirect('users:gaming_quiz') else: context = { "questions": questions, } return render(request, 'general/quiz_template.html', context) HTML: <form method="post"> {% csrf_token %} {% for question in questions %} <div> <label class="question">{{ question.question_text }}</label> <ul class="errors"> {% for error in form.errors %} <li>{{ error }}</li> {% endfor %} </ul> <div> <label class="form-check-inline"> <input type="radio" name="question_{{ question.id }}" value="option1"> {{ question.option1 }} </label> <label class="form-check-inline"> <input type="radio" name="question_{{ question.id }}" … -
how to fix SMTPServerDisconnected at /accounts/register/ Connection unexpectedly closed in django
I am working on a project using django where the user needs to register and get the activation link on email and login. everything is working fine user can register but not able to see activation link on email instead it brings the error: SMTPServerDisconnected at /accounts/register/ Connection unexpectedly closed in django here is part of my settings.py i have my .env file where i kept my MAIL = rukiaselemani360@gmail.com and PASSWORD i put the password generated by App Password after two-factor authentication enabled on Gmail account. # settings.py mail = os.environ.get("MAIL") mail_pass = os.environ.get("PASSWORD") EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend" EMAIL_HOST = "smtp.gmail.com" EMAIL_PORT = 587 EMAIL_USE_TLS = True EMAIL_HOST_USER = mail EMAIL_HOST_PASSWORD = mail_pass DEFAULT_FROM_EMAIL = mail # views.py from .forms import RegistrationForm from django.contrib.sites.shortcuts import get_current_site from django.template.loader import render_to_string from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode from django.utils.encoding import force_bytes, force_str from .tokens import account_activation_token from django.core.mail import EmailMessage from django.contrib import messages from django.shortcuts import redirect, render from django.contrib.auth import get_user_model, login from django.urls import reverse def index(request): messages_to_display = messages.get_messages(request) return render(request, "index.html", {"messages": messages_to_display}) def register_user(request): form = RegistrationForm() # Initialize the form instance if request.method == "POST": form = RegistrationForm(request.POST) if form.is_valid(): user = form.save(commit=False) user.is_active = … -
Django mysql icontains not working for small case
When I type Travel exactly same as my database it's working but when type travel it's working even I tried icontains for ignore case sensitivity. my code: similar_titles_query = Q(title__icontains=search_query) & Q(parent_product__isnull=True, domain_name=domain_name,is_published=False) similar_titles_results = Product.objects.filter(similar_titles_query).order_by('?')[:5] -
Django: Select multiple random ids and insert to database
I'm generating schedules and it will automatically choose from RoutePoint class. I wanted to POST all these ids and create # of rows based on how many id's the user wants. This is how I select random ids. no_of_route = request.POST.get('time') items = list(RoutePoints.objects.all()) random_route = random.sample(items, no_of_route)[0] So the problem is, I don't know how to insert these ids. Like bulk insert? If the user choose 3 no_of_route, there should be 3 rows inserted to 'Schedule' table. Schedule.objects.create(route=random_route, report_time=report_time) This is my first time, so I'm not sure how to do it exactly. Thank you for your help. -
Setting AUTH_USER_MODEL for user app within a v1 folder
My django project structure looks like this /api manage.py poetry.lock /api /v1 __init__.py /users __init__.py models.py ... /properties __init__.py ... I'm trying to set up a custom User model by setting AUTH_USER_MODEL within settings.py. However, I'm getting this error django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL refers to model 'user.User' that has not been installed I've tried values AUTH_USER_MODEL = "api.v1.user.User" AUTH_USER_MODEL = "v1.user.User" AUTH_USER_MODEL = "user.User" But none of them fixed the issue I also have these INSTALLED_APPS INSTALLED_APPS = [ "django.contrib.admin", "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", "rest_framework", "api.v1.users", "api.v1.reservations", "api.v1.properties", ] and my User model currently looks like this class User(AbstractUser): pass -
issues when installing an existing DRF react app on pythonanywhere
What i need ? Install and run given app code from link below on pythonanywhere https://github.com/veryacademy/YT-Django-DRF-Simple-Blog-Series-JWT-Part-3.git pre requisite is install npm, npx. For this I referred to page https://help.pythonanywhere.com/pages/React/ what i am trying ? CMIIAW. I presume that "react" folder in the git is already a create-react-app ( minus node_modules ) So to create node_modules folder I can create a new react app called "frontend" and copy node_modules into "react" folder npm install -g react create-react-app npx create-react-app frontend what i am getting ? (.myenv) 04:01 ~/YT-Django-DRF-Simple-Blog-Series-Part-1/react (master)$ npx create-react-app frontend --force Creating a new React app in /home/nightly/YT-Django-DRF-Simple-Blog-Series-Part-1/react/frontend. Installing packages. This might take a couple of minutes. Installing react, react-dom, and react-scripts with cra-template... npm ERR! code Unknown system error -122 npm ERR! syscall write npm ERR! errno -122 **npm ERR! Unknown system error -122: Unknown system error -122, write ** npm ERR! A complete log of this run can be found in: /home/nightly/.npm/_logs/2024-04-20T04_01_57_768Z-debug-0.log Aborting installation. npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed. Deleting generated file... node_modules Deleting generated file... package.json Deleting frontend/ from /home/nightly/YT-Django-DRF-Simple-Blog-Series-Part-1/react Done. Even a --force option does not help here. How to solve this issue, so that I can … -
How to upload React-Django project on GitHub
enter image description here My website Backend on Django and the Frontend on React Backend enter image description here Frontend enter image description here When me try to upload the project on backend folder push to the GitHub