Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to use django-star-ratings
I got an error when I use django-star-ratings. Error 'str' object has no attribute '_meta' menu.html error at line 33 {% load ratings %} <div class="col-md-7"> <img src="{% static 'image/Indian-vegetarian-mark.svg' %}"> <h4 class="card-title" style="color: #FFC222;">{{i.product}}</h4> <h6 class="price-tag text-left mt-2 mb-1" style="font-size: 0.9rem;" > MRP:<span id=""> {{i.price}}</span> RS. </h6> {% ratings object %} </div> line 33 is {% rating object %} I also follow the document -
Method \"POST\" not allowed django
I am getting error as Method "POST" not allowed. urls.py from django.conf.urls import url from . import views urlpatterns = [ url('', views.listTutorials), url('create/', views.createTutorial), url('<str:pk>/update/', views.updateTutorial), ] views.py from rest_framework.decorators import api_view from rest_framework.response import Response from rest_framework import status from .serializers import TutorialSerializer from .models import Tutorial @api_view(['POST']) def createTutorial(request): serializer = TutorialSerializer(data=request.data) if serializer.is_valid(): serializer.save() return Response(status=status.HTTP_201_CREATED) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) @api_view(['PUT']) def updateTutorial(request, pk): tutorial = Tutorial.objects.get(pk=pk) serializer = TutorialSerializer(tutorial, data=request.data) if serializer.is_valid(): serializer.save() return Response(status=status.HTTP_204_NO_CONTENT) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) @api_view(['GET']) def listTutorials(request): tutorials = Tutorial.objects.all() serializer = TutorialSerializer(tutorials, many=True) return Response(serializer.data) serializers.py from rest_framework.serializers import ModelSerializer from .models import Tutorial class TutorialSerializer(ModelSerializer): class Meta: model = Tutorial fields = '__all__' models.py from django.db import models class Tutorial(models.Model): title = models.CharField(max_length=70, blank=False, default='') description = models.CharField(max_length=200,blank=False, default='') published = models.BooleanField(default=False) def __str__(self): return self.title project urls.py urlpatterns = [ url(r'^admin/', admin.site.urls), url('tutorials/', include('tutorials.urls')) ] Now I am using POST request as http://localhost:8000/tutorials/create/ with body { "title": "Django framework", "description": "Learning django framework" } But I am getting error { "detail": "Method "POST" not allowed." } -
Response body coming improperly in the browsable API in django
import json # Data to be written response = ['KIN', 'YAC', 'NAC', 'QUE', 'DEL'] context = {'categories': response} # Serializing json json_object = json.dumps(context, indent = 4) print(json_object) #return Response(json_object, status=status.HTTP_200_OK) On writing a code similar to this I gaet a response like this in the browsable API "{\"categories\": [\"KIN\", \"YAC\", \"NAC\", \"QUE\", \"DEL\"]}" whereas it is working fine on IDE. { "categories": [ "KIN", "YAC", "NAC", "QUE", "DEL" ] } I am new to django and some help will be appreciated. -
Django post_save signal ( request.COOKIES['device'] )
Currently working on a Django Ecommerce project so I would like to get the cookies of a user from the model I know we use request.COOKIES['device'] in our view but is there a way to get the cookies in our models part -
Django - How can I filter and count related objects of different ids
Model 1: class Member(models.Model): id = models.AutoField(primary_key=True) names = models.CharField(max_length=255, blank=True) student = models.ForeignKey('School', on_delete=CASCADE, null=True, blank=True) Model 2: class School(models.Model): id = models.AutoField(primary_key=True) I want to count the total students who are in different schools. I tried total_student = Members.filter(school=1+5+8).count()but this is not working. Note: 1, 5 and 8 are the ids of the same type of schools in the school model which different members attend. Please help me get this right. -
Django Unable to login credentials eventhough credentials is correct
I'm trying from a few days to create a login & register system for my WebSite, built with Django. But, every time I try to login to my account that I've created, I get an error. When I enter my credentials in the form and press the Submit button, the page reloads back to the signin page. Nevertheless, despite the credentials are right, I am given a mistake, and moreover on the wrong page. Here is my code. views.py from django.shortcuts import redirect, render from django.http import HttpResponse from .forms import UserForm, MemberForm from .models import User from django.contrib import messages, auth from django.contrib.auth.decorators import login_required, user_passes_test def registerUser(request): if request.method == 'POST': form = UserForm(request.POST) m_form = MemberForm(request.POST, request.FILES) if form.is_valid() and m_form.is_valid(): first_name = form.cleaned_data['first_name'] middle_name = form.cleaned_data['middle_name'] last_name = form.cleaned_data['last_name'] username = form.cleaned_data['username'] email = form.cleaned_data['email'] mobile_number = form.cleaned_data['mobile_number'] password = form.cleaned_data['password'] user = User.objects.create_user(first_name=first_name, middle_name=middle_name, last_name=last_name, username=username, email=email, mobile_number=mobile_number, password=password) user.role = User.MEMBER user.save() member = m_form.save(commit=False) member.user = user member.save() messages.success(request, 'Your account has been registered successfully!') print(user.password) return redirect('registerUser') else: print('invalid form') print(form.errors) else: form = UserForm() m_form = MemberForm() context = { 'form' : form, 'm_form' : m_form, } return render(request, 'accounts/register.html', context) … -
Django | no such table: users_profile Mysql
help me find a bug please. I am migrating my project from sqlite to mysql. When I create a superuser, I manage to connect to the database and create a user line in it, but I get an error when I open the website page: enter image description here I think the creation is sent correctly, but further queries are sent from sqlite. How can this be fixed, what is my mistake? Also, the sqlite database is automatically created (empty) - probably trying to search in it. I've already deleted all the migration files and the database itself, and then: python manage.py makemigrations users python manage.py migrate DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'bdname', 'USER': 'username', 'PASSWORD': 'password', 'HOST': '000.000.000.000', 'PORT': '' } } What other information can I provide? -
Est ce python django gere les images qui sont sur la machine après déploiement du site web gratuitement sur heroku?
Je suis étudiant et nouveau sur le langage python et le framework Django, je viens de développer un site pour mon université, sur le site il est possible de publier les actualités et chaque actualité a un champ obligatoire "image" qui hérite de la classe models: image=models.Imgefield(), quand mon site était en Local le locahost de ma machine garder les images que je chargeais sur mon site, depuis hier j'ai déployé mon site sur heroku, je me rends compte que je charge les photos sur chaque publication le matin mais le jour suivant je trouve que les images ne s'affichent pas , on m'affiche " image card up", moi je vais que je charge les images une seule fois au lieu d'avoir ce travail qui m'oblige de choisir les images chaque jour et le jour suivant ça n'apparaît plus, s'il vous plaît aidez moi -
How to create single Form for two models that are related by a Foreign Key?
I developed a voting system using Python and Django. I would like the user to be able to register new polls. However, when the user registers a new poll, it results in an IntegrityError. It looks like it can't get the ID of the first model. How do I fix this error? The photo of the error and the form is below... models.py from django.db import models from django.utils import timezone class Question(models.Model): question_text = models.CharField(max_length=200) pub_date = models.DateTimeField(default=timezone.now, verbose_name='Date') show = models.BooleanField(default=True) def __str__(self): return self.question_text class Choice(models.Model): question = models.ForeignKey(Question, on_delete=models.CASCADE) choice_text = models.CharField(max_length=200) votes = models.IntegerField(default=0) def __str__(self): return self.choice_text forms.py from django.forms import ModelForm from .models import * class addPollsForm(ModelForm): class Meta: model = Question fields = ['question_text', 'pub_date', ] class addChoiceForm(ModelForm): class Meta: model = Choice fields = ['choice_text'] views.py def addPollsPage(request): if request.user.is_authenticated: formAddPolls = addPollsForm() formAddChoice = addChoiceForm() if request.method == 'POST': formAddPolls = addPollsForm(request.POST) formAddChoice = addChoiceForm(request.POST) if formAddPolls.is_valid(): formAddPolls.save() if formAddChoice.is_valid(): formAddChoice.save() return redirect('votacao:index') context = {'formAddPolls': formAddPolls, 'formAddChoice': formAddChoice, } return render (request, 'votacao/addPolls.html', context) else: return redirect('main') addPolls.html <form action="" method="POST"> {% csrf_token %} {{formAddPolls.as_p}} {{formAddChoice.as_p}} {{formAddChoice.as_p}} {{formAddChoice.as_p}} <br> <input type="submit" name="Submit"> </form> IntegrityError error photo -
Django DetailView ValueError: Field 'id' expected a number but got 'Ryan'
I created a profile page that uses DetailView, but the profile page just doesn't work on newly created users and is giving me this error message: Internal Server Error: /user/Ryan/ Traceback (most recent call last): File "/Users/raymond/opt/anaconda3/envs/python388/lib/python3.9/site-packages/django/db/models/fields/__init__.py", line 1822, in get_prep_value return int(value) ValueError: invalid literal for int() with base 10: 'Ryan' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/Users/raymond/opt/anaconda3/envs/python388/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/Users/raymond/opt/anaconda3/envs/python388/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/Users/raymond/opt/anaconda3/envs/python388/lib/python3.9/site-packages/django/views/generic/base.py", line 69, in view return self.dispatch(request, *args, **kwargs) File "/Users/raymond/opt/anaconda3/envs/python388/lib/python3.9/site-packages/django/views/generic/base.py", line 101, in dispatch return handler(request, *args, **kwargs) File "/Users/raymond/opt/anaconda3/envs/python388/lib/python3.9/site-packages/django/views/generic/detail.py", line 107, in get context = self.get_context_data(object=self.object) File "/Users/raymond/Documents/GitHub/Management/blog/views.py", line 32, in get_context_data context['requests'] = Request.objects.filter(teacher=user.username, completed=False).order_by('-request_time') File "/Users/raymond/opt/anaconda3/envs/python388/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/Users/raymond/opt/anaconda3/envs/python388/lib/python3.9/site-packages/django/db/models/query.py", line 974, in filter return self._filter_or_exclude(False, args, kwargs) File "/Users/raymond/opt/anaconda3/envs/python388/lib/python3.9/site-packages/django/db/models/query.py", line 992, in _filter_or_exclude clone._filter_or_exclude_inplace(negate, args, kwargs) File "/Users/raymond/opt/anaconda3/envs/python388/lib/python3.9/site-packages/django/db/models/query.py", line 999, in _filter_or_exclude_inplace self._query.add_q(Q(*args, **kwargs)) File "/Users/raymond/opt/anaconda3/envs/python388/lib/python3.9/site-packages/django/db/models/sql/query.py", line 1375, in add_q clause, _ = self._add_q(q_object, self.used_aliases) File "/Users/raymond/opt/anaconda3/envs/python388/lib/python3.9/site-packages/django/db/models/sql/query.py", line 1396, in _add_q child_clause, needed_inner = self.build_filter( File "/Users/raymond/opt/anaconda3/envs/python388/lib/python3.9/site-packages/django/db/models/sql/query.py", line 1329, in build_filter condition = self.build_lookup(lookups, col, value) File "/Users/raymond/opt/anaconda3/envs/python388/lib/python3.9/site-packages/django/db/models/sql/query.py", line 1180, … -
Trying to have link shown if user owns post or if user is staff
I'm trying to hide an Edit and Delete button from posts made unless it's the user who made it, or the user is staff/superuser. I got it to work in my views.py to allow staff users to edit, but I can't get it to show in the html. {% if request.user == room.host and room.host.is_staff %} This is what I have currently but it's not showing me the links as a staff user. -
When extending a base.html , is the <!DOCTYPE html> tag passed on aswell?
The title says it all. Is the doctype of: (base.html) <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> Passed on to (home.html) {% extends 'base.html' %} Or do I need to declare the doctype in all of my documents? like so: <!DOCTYPE html> {% extends 'base.html' %} -
Django html script in TextField of a model
I created a mail model that has the following properties class Mail(models.Model): sender = models.ForeignKey(User, on_delete=models.CASCADE, related_name='sender') to = models.ForeignKey(User, on_delete=models.CASCADE, related_name='receiver') title = models.CharField(max_length=50) content = models.TextField() sent_time = models.DateTimeField(default=timezone.now) def get_absolute_url(self): return reverse('mail-detail', kwargs={'pk':self.pk}) I am trying to add a link that redirects to the detail of the request in the content section of the mail. This is what I tried m = Mail( sender=self.request.user, to=self.get_object().student, title='Request Comfirmed', content=f'Your request has been confirmed by {self.request.user.username}.' + '\n<small class="text-muted"><a class="ml-2" href="{% url \'request-defail\' ' + str(self.get_object().id) + ' %}">Click here to view details of the request</a></small>' ) This is what happened And this is how the mail is displayed <article class="media content-section"> <img class="rounded-circle article-img" src="{{ object.sender.profile.image.url }}" alt=""> <div class="media-body"> <div class="article-metadata"> <a class="mr-2" href="{% url 'user-profile' object.sender.username %}">{{ object.sender.username }}</a> <small class="text-muted">{{ object.sent_time }}</small> </div> <h2 class="article-titile">{{ object.title }}</h2> <p class="article-content">{{ object.content }}</p> </div> </article> -
Exception has occurred: ImportError Vscode While Debugging
I am trying to try the debug tool in my vs code I am totally new to vs code and I am getting an error such as this when I run it ERROR MESSAGE I have a folder called .vscode with a launch.json file ` "version": "0.2.0", "configurations": [ { "name": "Python: Django", "type": "python", "request": "launch", "program": "${workspaceFolder}\\myPro\\manage.py", "args": [ "runserver" ], "django": true, "justMyCode": true } ] } I watched a lot of videos on youtube and I see people who have settings.json in there .vscode file. WHAT I HAVE DONE: I have downloaded django == 3.25 I have downloaded python == 3.10.4 IN a virtual environment my environment works perfectly fine its just that I can find the reason to this problem I would really appreciate it if someone can help me out -
How to connect 2 models in the admin, if they are already connected OnetoOne?
models.py from django.contrib.auth.models import User class Customer(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE, null=True, blank=True) Every time for new user(when he registers) I must choose user in admin('in Customer model') https://prnt.sc/waTmROxj3-xn(screenshot), if I don't choose a new user I have error RelatedObjectDoesNotExist at / User has no customer. How to do it automatically? What I did do wrong? It is possible to catch this exception, but then what data should be added to the customer to connect it? It won't change the user's flag to his own(https://prnt.sc/waTmROxj3-xn(screenshot)): views.py def cartData(request): if request.user.is_authenticated: try: customer = request.user.customer except ObjectDoesNotExist: customer = ? order, created = Order.objects.get_or_create(customer=customer, complete=False) items = order.orderitem_set.all() cartItems = order.get_cart_items else: cookieData = cookieCart(request) cartItems = cookieData['cartItems'] order = cookieData['order'] items = cookieData['items'] return {'cartItems': cartItems, 'order': order, 'items': items} -
RuntimeError: There is no current event loop in thread 'Thread-1' in Django project
I have a Django project that should parse some data from a particular web-site and saves the data into the database. In the app I use requests_html that is somehow dependant on asyncio which raises an error each time i'm trying to make a request. (I have to use requests_html, not beautifulsoup because I need scripts to be rendered into html) Here is the isolated problem: # project/app/render_js.py import requests_html def render_js(url): session = requests_html.HTMLSession() r = session.get(url) r.html.render() return r.html.text # project/project/views from django.http import HttpResponse from app.render_js import render_js url = 'some url' def view(request): print(render_js(url)) return HttpResponse("<h1>success!</h1>") # project/project/urls from django.urls import path from .views import view urlpatterns = [ path('', view) ] While attempting to make a GET request to http://127.0.0.1:8000/ throws: Internal Server Error: / Traceback (most recent call last): File "C:\Users\User\PycharmProjects\project\venv\lib\site-packages\django\core\handlers\exception.py", line 55, in inner response = get_response(request) File "C:\Users\User\PycharmProjects\project\venv\lib\site-packages\django\core\handlers\base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "C:\Users\User\PycharmProjects\project\project\views.py", line 6, in view print(render_js('https://docs.python.org/3.7/library/threading.html#threading.Thread.run')) File "C:\Users\User\PycharmProjects\project\app\render_js.py", line 7, in render_js r.html.render() File "C:\Users\User\PycharmProjects\project\venv\lib\site-packages\requests_html.py", line 586, in render self.browser = self.session.browser # Automatically create a event loop and browser File "C:\Users\User\PycharmProjects\project\venv\lib\site-packages\requests_html.py", line 727, in browser self.loop = asyncio.get_event_loop() File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\asyncio\events.py", line 642, in … -
'NoneType' object has no attribute 'add' in Django Models
I have the next:'NoneType' object has no attribute 'add'. When I try to add a value to a null field (null=True) with auction.winner.add(u) it gives me that exception. I am working with Django Models and it looks like is not allowed to add a value to a null Field almost with this method. U know is there some way to do this? Thank U. -
Using a Class Based View, how do I add form kwargs without calling the form?
I have a model app/models.py: from django.db import models class MyModel(models.Model): my_field = models.Charfield(max_length=100, blank=True, null=True) I have a form in app/forms.py: from django import forms class MyForm(forms.ModelForm): def __init__(self, *args, **kwargs): custom_data = kwargs.pop('custom_field', None) super().__init__(*args, **kwargs) class Meta: fields = ['my_field'] And I have a CBV in app/views.py: from django.views import generic from .forms import MyForm class MyFormView(generic.FormView): template_name = 'my_form_template.html' form_class = MyForm Basically I want to be able to add some custom fields from my abstract User model which the form requires. I dont want to have some crazy context overrides, I just want to ensure the form always has the extra data upon initilisation. Any ideas? -
Django smtp cache with sendgrid
Since gmail smtp is not working, I am testing sendgrid smtp. It is working fine on a local host, but I cannot update it on a production site, because credentials cached there. I tried to clear cache with: python3 manage.py clearcache and from shell, but it is still now working. How can I make it work. -
Django CBVs: reuse query from get_queryset in get_context_data method in ListView
I need to pass a Tag object to the template, but without an additional query to the database in get_context_data method. Can you please tell me if there is a more elegant way to get the value from the get_queryset method in the get_context_data. And if there is a more elegant way, is it correct to declare your own fields in Django views class PostListView(ListView): model = Post paginate_by = 3 context_object_name = 'posts' template_name = 'blog/post/list.html' tag = None def get_queryset(self): data = super().get_queryset() if tag_slug := self.kwargs.get('tag_slug'): self.tag = get_object_or_404(Tag, slug=tag_slug) data = data.filter(tags__in=[self.tag]) return data def get_context_data(self, *, object_list=None, **kwargs): data = super().get_context_data(**kwargs) data['tag'] = self.tag return data -
Can't deploy to Heroku when my app uses Neomodel, because it wants to install Shapely>=1.7.1,<1.9 but it selects 1.7.1 which can't find geos_c.dll
The Django / Neo4j app I would like to deploy is this: https://github.com/enjoysmath/DiagramChasingGames Auto building on Heroku crashes with: -----> Building on the Heroku-20 stack -----> Determining which buildpack to use for this app -----> Python app detected -----> No Python version was specified. Using the buildpack default: python-3.10.6 To use a different version, see: https://devcenter.heroku.com/articles/python-runtimes -----> Installing python-3.10.6 -----> Installing pip 22.1.2, setuptools 60.10.0 and wheel 0.37.1 -----> Installing SQLite3 -----> Installing requirements with pip Collecting django Downloading Django-4.1-py3-none-any.whl (8.1 MB) Collecting gunicorn Downloading gunicorn-20.1.0-py3-none-any.whl (79 kB) Collecting django-heroku Downloading django_heroku-0.3.1-py2.py3-none-any.whl (6.2 kB) Collecting requests Downloading requests-2.28.1-py3-none-any.whl (62 kB) Collecting neomodel Downloading neomodel-4.0.8-py3-none-any.whl (46 kB) Collecting django-neomodel Downloading django_neomodel-0.0.7-py3-none-any.whl (14 kB) Collecting dj-database-url Downloading dj_database_url-1.0.0-py3-none-any.whl (6.6 kB) Collecting whitenoise Downloading whitenoise-6.2.0-py3-none-any.whl (19 kB) Collecting bidict Downloading bidict-0.22.0-py3-none-any.whl (36 kB) Collecting django-bootstrap5 Downloading django_bootstrap5-21.3-py3-none-any.whl (24 kB) Collecting psycopg2 Downloading psycopg2-2.9.3.tar.gz (380 kB) Preparing metadata (setup.py): started Preparing metadata (setup.py): finished with status 'done' Collecting sqlparse>=0.2.2 Downloading sqlparse-0.4.2-py3-none-any.whl (42 kB) Collecting asgiref<4,>=3.5.2 Downloading asgiref-3.5.2-py3-none-any.whl (22 kB) Collecting charset-normalizer<3,>=2 Downloading charset_normalizer-2.1.0-py3-none-any.whl (39 kB) Collecting certifi>=2017.4.17 Downloading certifi-2022.6.15-py3-none-any.whl (160 kB) Collecting idna<4,>=2.5 Downloading idna-3.3-py3-none-any.whl (61 kB) Collecting urllib3<1.27,>=1.21.1 Downloading urllib3-1.26.11-py2.py3-none-any.whl (139 kB) Collecting neobolt==1.7.17 Downloading neobolt-1.7.17.tar.gz (183 kB) Preparing metadata (setup.py): started Preparing … -
Converting Nested SQL to ORM in Django
I have a Query Like this SELECT *, ( SELECT COALESCE(json_agg(product_attribute), '[]') FROM ( SELECT * FROM optimus_productattribute as product_attribute WHERE product.id = product_attribute.product_id ) AS product_attribute ) AS product_atttribute FROM optimus_product as product inner join optimus_store as store on product.store_id = store.id and I want to convert it to ORM Have Tried JSONBAgg but it says it can only be used to have Single Column Product.objects.filter(store_id=787).annotate(attributes=Coalesce(JSONBAgg(ProductAttribute.objects.filter(product=OuterRef('pk')).values_list('id', 'uuid')),[])) -
Invoice system with multiple companies/users DJANGO
I need help with creating an invoice system in Django, stucked with models, how to orginize data. The idea is that one user can be in different companies and one company can have multiple users. One company can have multiple invoices with an unlimited number of products. For example: CompanyA sends an invoice with custom products to CompanyB CompanyB receives an invoice from CompanyA and sends a debit note to CompanyA. So, Company could be either a Supplier and a Customer. I tried to make some DB scheme, maybe it would be easier to understand what I try. Sample database scheme -
Filter by URL Kwargs while using Django FilterSets
I have an endpoint that can follow this format: www.example.com/ModelA/2/ModelB/5/ModelC?word=hello Model C has a FK to B, which has a FK to A. I should only ever see C's that correspond to the same A and B at one time. In the above example, we should... filter C by those with an FK to B id = 5 and A id = 2 also filter C by the field 'word' that contains hello. I know how to use the filter_queryset() method to accomplish #1: class BaseModelCViewSet(GenericViewSet): queryset = ModelC.objects.all() class ModelCViewSet(BaseModelCViewSet, mixins.RetrieveModelMixin, mixins.ListModelMixin): def filter_queryset(self, queryset): return queryset.filter(ModelB=self.kwargs["ModelB"], ModelB__ModelA=self.kwargs["ModelA"]) I also know how to use a Filterset class to filter by fields on ModelC to accomplish #2 class ModelCFilterSet(GeoFilterSet): word = CharFilter(field_name='word', lookup_expr='icontains') But I can only get one or the other to work. If I add filterset_class = ModelCFilterSet to ModelCViewSet then it no longer does #1, and without it, it does not do #2. How do I accomplish both? Ideally I want all of this in the ModelCFilterSet Note - As hinted by the use of GeoFilterSet I will (later on) be using DRF to add a GIS query, this is just a simplified example. So I think … -
Static Files Django - HEROKU
When I turn off the PC and turn it back on and try to edit a static file on django this doesn't work. To make it work I have to rename it, and since I use HEROKU to host my site I don't want to use this method. Is there an alternative for not renaming static files and making them work anyway?